Make tables of standard encryption schemes etc.
[u/mdw/catacomb] / fibrand.c
index 950fd76..eb2e86d 100644 (file)
--- a/fibrand.c
+++ b/fibrand.c
@@ -1,6 +1,6 @@
 /* -*-c-*-
  *
- * $Id: fibrand.c,v 1.2 2000/06/17 10:55:24 mdw Exp $
+ * $Id: fibrand.c,v 1.4 2002/10/09 00:35:18 mdw Exp $
  *
  * Fibonacci generator
  *
 /*----- Revision history --------------------------------------------------* 
  *
  * $Log: fibrand.c,v $
+ * Revision 1.4  2002/10/09 00:35:18  mdw
+ * Fix bogus type name.
+ *
+ * Revision 1.3  2000/12/06 20:31:06  mdw
+ * Simplify uniform range transformation.
+ *
  * Revision 1.2  2000/06/17 10:55:24  mdw
  * Typesetting fixes.  Add flags word to generatic random generator.
  *
@@ -144,12 +150,12 @@ void fibrand_lcseed(fibrand *f, uint32 seed)
 uint32 fibrand_range(fibrand *f, uint32 m)
 {
   uint32 r = 0xffffffff - (0xffffffff % m);
-  uint x;
+  uint32 x;
 
   /* --- Now generate numbers until a good one comes along --- */
 
   do x = fibrand_step(f); while (x >= r);
-  return (x / (r / m));
+  return (x % m);
 }
 
 /*----- Generic interface -------------------------------------------------*/