[fpc-pascal] Better random numbers ?

A.J. Venter aj at getopenlab.com
Sun Feb 26 23:18:32 CET 2006

Hi, I am using standard run of the mill randomize/random() calls in a program 
to generate random numbers, used in turn to select random data which is fed 
into another program.
(All this just to create a multi-language enabled module structure eh)

Well there is just one little problem, on the commandline it works fine, just 
about every single call gives a different result, or different enough.

But when run from inside my other app (where it is threaded) and where I 
cannot proceed until I have at least the first 5 non-repeating values, it 
doesn't work so great, I have to call the program an average of 40 times 
before the value changes - I presume because randomize gets it's seed from 
the clock and that is how long it takes for the whichever value it uses to 

So is there a better way I can do this ? Some way of getting a more frequently 
updated random seed ? I am talking literally every few milliseconds here.
A.J. Venter
Chief Software Architect
OpenLab International
+27 82 726 5103

More information about the fpc-pascal mailing list