Random number generation on 8 bit computers can be confusing, so I’ll try to demystify it for you.
| Apple ][ | example |
|---|---|
| RND(1) random # between 0 & 1 RND(0) repeats last result RND(-1) reseeds the generator | int( rnd(1) * max) + min |
| Commodore 64 | example |
|---|---|
| RND(1) random # between 0 & 1 RND(0) is not as good as 1 | int( rnd(1) * max) + min |
| TRS-80 | example |
|---|---|
| RANDOM – Seeds the generator RND(x) if x > 0, # between 1 & x RND(0) random # between 0 & 1 |
| Atari 800 | example |
|---|---|
| RND a # between 0 – 255 RANDOM a # between 0-65535 |
| Quick Basic 64 | example |
|---|---|
| RND(1) random # between 0 & 1 RND(0) repeats last result RANDOMIZE x or TIMER, seeds the generator | int( rnd(1) * max) + min |
An important thing to remember is that these are pseudo-random number generators, meaning that while they are pretty good at it, they cannot generate true random numbers. Some are better than others, with the exception of Commodore’s RND(0) which is not good.
Also, I’m not really sure why you would use the RND(0) on Apple & QB64 to repeat last result.
Thank you for stopping by.
home | my recipes | my photos | I’m high
