projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New source files and tests.
[u/mdw/catacomb]
/
grand.c
diff --git
a/grand.c
b/grand.c
index
0f9eee5
..
b7118ab
100644
(file)
--- a/
grand.c
+++ b/
grand.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: grand.c,v 1.
1 1999/12/10 23:16:01
mdw Exp $
+ * $Id: grand.c,v 1.
2 2000/12/06 20:31:06
mdw Exp $
*
* Generic interface to random number generators
*
*
* Generic interface to random number generators
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: grand.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: grand.c,v $
+ * Revision 1.2 2000/12/06 20:31:06 mdw
+ * Simplify uniform range transformation.
+ *
* Revision 1.1 1999/12/10 23:16:01 mdw
* Generic interface.
*
* Revision 1.1 1999/12/10 23:16:01 mdw
* Generic interface.
*
@@
-126,7
+129,6
@@
uint32 grand_range(grand *r, uint32 l)
*/
z = m - (m % l);
*/
z = m - (m % l);
- m = z / l;
/* --- Generate numbers until something acceptable is found --- *
*
/* --- Generate numbers until something acceptable is found --- *
*
@@
-134,7
+136,7
@@
uint32 grand_range(grand *r, uint32 l)
*/
do x = w(r); while (x >= z);
*/
do x = w(r); while (x >= z);
- return (x
/ m
);
+ return (x
% l
);
}
}
}
}