Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Is the Randomize command reliable?  (Read 2292 times)

0 Members and 1 Guest are viewing this topic.

JudgeGroovyman

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 2
  • Generic Amiga User
Is the Randomize command reliable?
« 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.

Logged

adrazar

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 69
  • Generic Amiga User
Re: Is the Randomize command reliable?
« Reply #1 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))
« Last Edit: September 20, 2021, 01:38:25 PM by adrazar »
Logged
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022