jon93
New Member
Posts: 15
|
Post by jon93 on Aug 8, 2022 15:54:10 GMT
I like doing random things, hoping to find something like a Strange Attractor, or to find some new cellular automaton in Conway's Game of Life. (Unlikely!). So I want to use rnd(1) as a pseudorandom number generator. But I also want to be able to replay the same sequence. In some languages you can use a random number seed, which will produce the same pseudorandom sequence. But I can't find one in Justbasic. Does it exist?
Jon
|
|
|
Post by plus on Aug 8, 2022 16:20:06 GMT
|
|
|
Post by tsh73 on Aug 8, 2022 16:47:03 GMT
Basic way is Randomize seed Seed is in 0..1 range
|
|
|
Post by plus on Aug 8, 2022 17:36:29 GMT
Oh yeah, now I remember doing that for codes.
|
|
|
Post by tenochtitlanuk on Aug 8, 2022 17:40:53 GMT
If you re interested in PRNGs you might look on my website at www.diga.me.uk . Examples of 'random' functions and the ( unimportant, small) bias of LB/JB rnd(. I often use randomize to produce repeatable sequences when testing programs..
|
|
|
Post by Rod on Aug 8, 2022 18:06:06 GMT
Hope the OP caught that, RANDOMIZE is the command to seed the PRNG and get repeatable sequences of numbers.
|
|
jon93
New Member
Posts: 15
|
Post by jon93 on Aug 8, 2022 19:19:37 GMT
Thank you everyone. Randomize seed is just what I was hoping for. I am new here and continue to be amazed at all the help and ideas offered here. I used quick basic until dos was obsolete. I had no idea that basic still lives and thrives.
Jon
|
|