Random Numbers
Posted: Sun Mar 13, 2016 7:04 am
I recently reported that the rnd(0) function was not working in vice (now fixed).
But, inspired by Mike's post
http://sleepingelephant.com/ipw-web/bul ... ber#p85580
I tried this out in vice
and got a disappointing result.
So I changed rnd(0) to rnd(1) in line 30 and got a much more satisfying result.
Thinking that it was still a problem in vice, I typed the prog into a real vic.
OUCH!!! - similar results
Mike wrote
It's not too bad with small numbers like simulating dice throws (1-6 or 1-12) but the larger the range the worse it gets.
After reading the programmers guide, I think that rnd(0.5) might be the better choice.
Any thoughts?
But, inspired by Mike's post
http://sleepingelephant.com/ipw-web/bul ... ber#p85580
I tried this out in vice
Code: Select all
10 print chr$(147):c=38399:s=7679
20 for x=1 to 506:poke c+x,6:next
30 x=int(rnd(0)*506)+1
40 poke s+x,160:goto 30
So I changed rnd(0) to rnd(1) in line 30 and got a much more satisfying result.
Thinking that it was still a problem in vice, I typed the prog into a real vic.
OUCH!!! - similar results
Mike wrote
All this time I assumed that this was how to generate random numbers, after all, most example programs and type-ins that need random numbers use rnd(0).one needs to wonder if it actually even ever worked on real hardware
It's not too bad with small numbers like simulating dice throws (1-6 or 1-12) but the larger the range the worse it gets.
After reading the programmers guide, I think that rnd(0.5) might be the better choice.
Any thoughts?