projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ooops, fix all the bugs.
[u/mdw/catacomb]
/
fibrand.c
diff --git
a/fibrand.c
b/fibrand.c
index
950fd76
..
eb2e86d
100644
(file)
--- a/
fibrand.c
+++ b/
fibrand.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-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
*
*
* Fibonacci generator
*
@@
-30,6
+30,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: fibrand.c,v $
/*----- 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.
*
* 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);
uint32 fibrand_range(fibrand *f, uint32 m)
{
uint32 r = 0xffffffff - (0xffffffff % m);
- uint x;
+ uint
32
x;
/* --- Now generate numbers until a good one comes along --- */
do x = fibrand_step(f); while (x >= r);
/* --- 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 -------------------------------------------------*/
}
/*----- Generic interface -------------------------------------------------*/