This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

nooby123
nooby123 presents ...

2013/12/30

Linear Congruential Generator (LCG)

The red number shows the random numbers. The black represents when the red-colored numbers repeat.

2433 views / 9 in the last 7 days

Tags: demo fun with-source random number

open in greenfoot
Your browser does not support the canvas tag.
shrucis1shrucis1

2013/12/30

The way you detect repetition is flawed, I'll get a number sequence like so: 114 - 60 - 456 - 240 - 480 - 288 - 576 - 480 - 288 - 576 - 480 - 288... etc., repeating 288, 576, and 480, but the entire thing is red, as though it didn't repeat at all. I imagine it's looking for the next time it sees the value 114 followed by 60... and so on.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.