News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
math.random(what?)
Author Message
iGame3D
Moderator
***


Posts: 231
Group: Moderators
Joined: Apr 2007
Status: Offline
Reputation: 0
Post: #1
RE: math.random(what?)

ok first you want to set the random seed so that the machine actually initializes a sorta psuedo randomness.

Code:
math.randomseed(os.time())

Now you should get a decently random number, especially when its called more than once since the seed will change, once is usually enough.

Random numbers were the very first thing I tried in Lua since I
used tons and tons of random-icity back 1983 with BASIC
and then later with my very many strange iGame3D experiments.

This post was last modified: 07-27-2007 10:22 AM by iGame3D.

07-27-2007 10:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
math.random(what?) - mikshaw - 07-27-2007, 09:08 AM
RE: math.random(what?) - iGame3D - 07-27-2007 10:06 AM
RE: math.random(what?) - mikshaw - 07-27-2007, 01:37 PM
RE: math.random(what?) - iGame3D - 07-27-2007, 03:16 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: