SeedRnd MilliSecs()

Blitz3D Forums/Blitz3D Beginners Area/SeedRnd MilliSecs()

Steven Noyce(Posted 2006) [#1]
I don't realy need help with this, I was just wondering about this.
Why does this program look like everything happens exactly the same every time?
Graphics 640,480
SetBuffer BackBuffer()
SeedRnd MilliSecs()
Type star
	Field x
	Field y
	Field xspeed
	Field yspeed
	Field size#
	Field distance
End Type

For stars=1 To 1000
	s.star=New star
	s\x=Rand(-20,20)+320
	s\y=Rand(-15,15)+240
	If s\x>320 Then s\xspeed=Rand(1,2)
	If s\x<320 Then s\xspeed=Rand(-1,-2)
	If s\y>240 Then s\yspeed=Rand(1,2)
	If s\y<240 Then s\yspeed=Rand(-1,-2)
	s\size=Rnd(1,2)
Next

While Not KeyDown(1)
Cls

For s.star=Each star
	s\x=s\x+s\xspeed
	s\y=s\y+s\yspeed
	s\size=s\size+(s\size)/200
	Oval s\x,s\y,s\size,s\size
	s\distance=Sqr(((320-s\x)^2)+((240-s\y)^2))
	If s\distance>500
		s\x=Rand(-20,20)+320
		s\y=Rand(-15,15)+240
		If s\x>320 Then s\xspeed=Rand(1,2)
		If s\x<320 Then s\xspeed=Rand(-1,-2)
		If s\y>240 Then s\yspeed=Rand(1,2)
		If s\y<240 Then s\yspeed=Rand(-1,-2)
		s\size=Rnd(1,2)
	EndIf
Next

Flip
Wend
End



Ross C(Posted 2006) [#2]
Nope, you can see differences in the patterns of the white dots. The movement isn't random though. :o) The movement is ste to happen the same way every time.


Steven Noyce(Posted 2006) [#3]
Yeah, I see it now, sorry for making a thread without a good reason.


Ross C(Posted 2006) [#4]
S'ok man :o) You post if you need help. In this case you needed help with understanding something.


_PJ_(Posted 2006) [#5]
It's so easily to miss stuff with your own code, especially when you've been staring at it for hours. Hell I do it ALL the time ;)


Shifty Geezer(Posted 2006) [#6]
I find problems that ellude me are often solved by myself the moment they go public. I reckon a good 50% of the time questions I post I answer myself before anyone else has even read them!


Nicstt(Posted 2006) [#7]
It's so easily to miss stuff with your own code, especially when you've been staring at it for hours. Hell I do it ALL the time ;)


Glad its not just me:)