Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomize problem? (*solved*)
#1
I've searched the forums about this issue but I haven't found anything.

I gather that RANDOMIZE uses the timer to seed the variable, doesn't it? So this program, depending on the time I take to press the key, should render different numbers. Well, the result is always 6.

Code:
Print "PRESS KEY": Pause 0
Randomize
Let a = Int (Rnd * 10)
Print a

If I try...

Code:
'''
Dim a as uByte
Dim b as uByte
Print "PRESS KEY": Pause 0
b = Peek 23672
Print "FRAMES LSB IS "; b
Randomize b
let a = Int (Rnd * 10)
Print a

The result is always 0, no matter which value is in b. This shouldn't be!

I'm using 1.2.9-s888
Reply
#2
Hello Na_th_an !

With 1.2.9 (Current Stable Version) seems to work well :roll:
Reply
#3
Sorry for the delay (I'm quite busy these days Sad ).
As JGBV says, try the latest version. 1.2.9 changes the RND generator (Britlion proposed a better & faster generator), and I remember I had also to fix-up the RANDOMIZE routine in the meanwhile (you might have an intermediate version).
Reply
#4
Thanks, I didn't realise that the stable version was updated, my fault Smile
Cheers!

BTW, we have a new release, complete with new library, very soon.
Reply
#5
Yes. We're on this one, now.

<!-- m --><a class="postlink" href="http://xkcd.com/221/">http://xkcd.com/221/</a><!-- m -->
Reply
#6
britlion Wrote:Yes. We're on this one, now.

<!-- m --><a class="postlink" href="http://xkcd.com/221/">http://xkcd.com/221/</a><!-- m -->
LOOOOL! :lol:
Reply
#7
The funny thing is, in case you don't know, that joke is about the reason why the PS3 was hacked last year. The random number to generate the signatures was always 4.
Reply
#8
na_th_an Wrote:The funny thing is, in case you don't know, that joke is about the reason why the PS3 was hacked last year. The random number to generate the signatures was always 4.
:mrgreen:
Well, I knew It was related to PS3 (I own one) the the random number bug, but didn't know it was just that!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)