Anonymous user
Linear congruential generator: Difference between revisions
no edit summary
No edit summary |
|||
Line 112:
10450
30612</pre>
=={{header|bc}}==
{{trans|dc}}
{{works with|GNU bc}}
As with dc, bc has no bitwise operators.
<lang bc>/* BSD rand */
define rand() {
randseed = (randseed * 1103515245 + 12345) % 2147483648
return randseed
}
randseed = 1
rand(); rand(); rand(); print "\n"
/* Microsoft rand */
define rand() {
randseed = (randseed * 214013 + 2531011) % 2147483648
return randseed / 65536
}
randseed = 1
rand(); rand(); rand(); print "\n"</lang>
=={{header|C}}==
|