Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Forum => Topic started by: JudgeGroovyman on September 15, 2021, 04:13:47 PM

Title: Is the Randomize command reliable?
Post by: JudgeGroovyman on September 15, 2021, 04:13:47 PM
I need reliable pseudo random numbers and under the randomize command in the manual it says "the sequence of numbers generated by the RND function will be exactly the same each time your program is run." 

Does anyone know how to get this program to give the same result every time it is run?  or why it doesnt?

Code: [Select]
randomize 1000: print str$(rnd(100))
Any light you can shed on this would be helpful.     I'll make my own pseudo random function in the meantime.

Title: Re: Is the Randomize command reliable?
Post by: adrazar on September 19, 2021, 08:31:09 PM
Turns out you have to use negative numbers as input to get a deterministic sequence of numbers. If positive inputs are used the video beam position gets thrown into the calculation :P
Code: [Select]
Randomize 1000 : Print Str$(Rnd(-100))