Re: Separate threads of random numbers

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun,  7 Apr 2002 14:10:25 +0000, Andy Serpa
<renegade at earthling.net> wrote:

How about doing this:
 init():
set_rand(12345)
seed[1]=rand(1073741823)  -- use max range for thread seeds
seed[2]=rand(1073741823)
seed[3]=rand(1073741823)

&
function get_next_rand(integer thread, integer limit)
integer result
    set_rand(seed[thread])
    result=rand(limit)
    seed[thread]=rand(1073741823)
    return result

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu