better randomness

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

better randomness

Post by y offs et »

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.
Attachments
notRandom.zip
(347 Bytes) Downloaded 422 times
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

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.
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

In format of number of seconds from mid night should suffice for randomness. For other uses, I don't know.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

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,.
Attachments
kindaRandom.zgeproj
timed randomness
(1.81 KiB) Downloaded 432 times
iterationGAMES.com
Post Reply