X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/d34decd2b2b88240cf4ca68a2a5feb7bf36de6e7..80be023065ced106a4078a36371c135a60d2bd6c:/mprand.c diff --git a/mprand.c b/mprand.c index d4acbb3..0baae4f 100644 --- a/mprand.c +++ b/mprand.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mprand.c,v 1.3 2000/06/17 11:45:09 mdw Exp $ + * $Id: mprand.c,v 1.5 2004/04/08 01:36:15 mdw Exp $ * * Generate a random multiprecision integer * @@ -27,22 +27,6 @@ * MA 02111-1307, USA. */ -/*----- Revision history --------------------------------------------------* - * - * $Log: mprand.c,v $ - * Revision 1.3 2000/06/17 11:45:09 mdw - * Major memory management overhaul. Added arena support. Use the secure - * arena for secret integers. Replace and improve the MP management macros - * (e.g., replace MP_MODIFY by MP_DEST). - * - * Revision 1.2 1999/12/22 15:55:33 mdw - * Modify `mprand' slightly. Add `mprand_range'. - * - * Revision 1.1 1999/12/10 23:23:05 mdw - * Support for generating random large integers. - * - */ - /*----- Header files ------------------------------------------------------*/ #include @@ -137,7 +121,7 @@ mp *mprand_range(mp *d, mp *l, grand *r, mpw or) * As usual, the number of iterations expected is two. */ - b = (b - 1) & 7; + b = ((b - 1) & 7) + 1; m = (1 << b) - 1; do { r->ops->fill(r, v, sz);