Random values always the same

Blitz3D Forums/Blitz3D Beginners Area/Random values always the same

Mr. Slat(Posted 2007) [#1]
Well, this is strange but, i've noticed for some time now, That Rand() Command returns always the same results.. for instance, if you write, for x = 1 to 10 : Text 1,1, rand(1,10): Next , It will write 10 different numbers.... the tricky thing is that if you run the program again, the 10 numbers will be the same!! over and over....each time you run, no matter how many times you do it, it's always the same numbers..

how can I get real random numbers? this is the first time I see something like this on a programming language!!!


Kev(Posted 2007) [#2]
SeedRnd MilliSecs()


chwaga(Posted 2007) [#3]
yeah, or if you want uber-random stuff, do something like Seedrnd (Millisecs()/45*100+73/5)
=D


Mr. Slat(Posted 2007) [#4]
chwaga...that seams to be an illegal type conversion


DQ(Posted 2007) [#5]
i think he was just trying to make a point. are you seeding the rand function w/ seernd?


Mr. Slat(Posted 2007) [#6]
yeah ok whatever, thanks anyway.


chwaga(Posted 2007) [#7]
mr. slat, that seems like you spelled "seems" incorrectly.

take that!


Mortiis(Posted 2007) [#8]
LOL


chwaga(Posted 2007) [#9]
besides, I tried doing it and got no illegal type conversion when i used that, look at this!

SeedRnd (MilliSecs/83*50+30*93-2/50)

Graphics 1280, 1024, 32, 1
LockBuffer FrontBuffer()
Repeat

WritePixelFast Rnd(2, 1278), Rnd(2, 1022), Rnd(0, 10000)

Until KeyHit(1)

End 



big10p(Posted 2007) [#10]
Seedrnd (Millisecs()/45*100+73/5)
That won't make your random number generation anymore random, anyway. SeedRnd(Millisecs()) is as good as it gets.


chwaga(Posted 2007) [#11]
shut up and let me have my fun