RosettaCodeData/Task/Linear-congruential-generator/Quackery/linear-congruential-generator.quackery
2023-07-01 13:44:08 -04:00

26 lines
534 B
Text

[ number$
10 over size -
space swap of
swap join echo$ ] is echonum ( n --> )
[ stack 0 ] is BSD-seed ( --> n )
[ BSD-seed take
1103515245 *
12345 +
hex 7FFFFFFF &
dup BSD-seed put ] is BSD-rand ( --> n )
[ stack 0 ] is MCR-seed ( --> n )
[ MCR-seed take
214013 *
2531011 +
hex 7FFFFFFF &
dup MCR-seed put
16 >> ] is MCR-rand ( --> n )
say " BSD-rand MCR-rand" cr
10 times
[ BSD-rand echonum
MCR-rand echonum cr ]