I refer you to this page -
http://www.delphibasics.co.uk/RTL.asp?Name=Random
"Delphi uses a pseudo random number generator ..."
The use of system time as a seed is used in other languages also, and works well as long as the application is not generated automatically at a preset time.
I request a "Randomize" type function, or, probably easier, a way to access system time.
Now before you say "personality" check the enclosed demo.
-------------------------------
I have thought of another way that would work for what I am doing. I could have a read-in text file with a value to use as a seed, and on program closing, write-out the value plus one, so next start the seed would be different.
better randomness
Moderator: Moderators
better randomness
- Attachments
-
- notRandom.zip
- (347 Bytes) Downloaded 426 times
I see the problem, personality becomes the same every time. Inside the editor it is a new value on each run. In a game you would have a title-screen that required a keypress and if that title-screen also made use of the random-function then the game would use different random values because the user won't press the key at exactly the same time.
We could add a getSystemTime() function to scripting, this can be useful for other things as well.
We could add a getSystemTime() function to scripting, this can be useful for other things as well.
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
A getSystemTime() would be usefull for various things, please do. .
I was sorta suprised at first, when I started making games, at how difficult it is to get a computer to generate random numbers. I just go with Villes suggestion of a human intervention in a loop to generate random starting positons in the generator,. slight timeing differences seem to suffice,. . the whole psudo-randomness turns out to be a great thing for procedurals though,. from graphics, to mazes,. and wave formations,. getting the same 'random' pattern is very usefull actually.
attached is a little expansion of the above example,.
I was sorta suprised at first, when I started making games, at how difficult it is to get a computer to generate random numbers. I just go with Villes suggestion of a human intervention in a loop to generate random starting positons in the generator,. slight timeing differences seem to suffice,. . the whole psudo-randomness turns out to be a great thing for procedurals though,. from graphics, to mazes,. and wave formations,. getting the same 'random' pattern is very usefull actually.
attached is a little expansion of the above example,.
- Attachments
-
- kindaRandom.zgeproj
- timed randomness
- (1.81 KiB) Downloaded 437 times
iterationGAMES.com