gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

Random numbers do not seem to be very random #240

Open apblack opened 7 years ago

apblack commented 7 years ago

The results from random.intergerIn(_)to(_) seem very non-random. A sample of five numbers from 30 to 45 yields [43, 42, 42, 42, 38] or other sequences with three duplicates in a row much more frequently that seems reasonable.

It's probably time that we implemented our own PRNG, or at least found one in a JS library. Then we could also use multiple seeds to have multiple independent PRNGs