Interpreter and Compiler Project

A Better Random Number Generator

Friday, 22nd November 2019

The Random Number Generator originally offered on the Subroutine Library has its limitations. Though it uses only one variable, it shows easily discernible patterns and is limited to numbers up to about 6400. So a second random number generator has been added to the subroutine library.

The Wichmann-Hill Random Number Generator offers a better sequence of pseudorandom numbers, and has a higher limit - over 24000. It has a couple of downsides: there are three separate seeds to initialise, and it uses up four of Tiny BASIC's precious 26 variables.

But if your Tiny BASIC project needs a better sequence of random numbers than the simpler generator provides, then it may be worth sacrificing those extra variables. Get the new generator from the Subroutine Library.


New Comment

Yes No