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 
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Question  math.random(what?)

I was debating whether to start a general "please help mik with everything he doesn't understand" thread, since I think there will be a lot in the coming months, but I guess while the forums are still relatively slow I'll stick with one thread per subject.

The current thing I can't figure out is the math.random function, which I assume is supposed to return a pseudo-random number. However, it seems to return the same number every time.
If I use no argument the result is always 0.84018771715471
math.random(6) or math.random(1,6) always returns 6
math.random(1,12) always returns 11
...and on and on with these seemingy illogical results

Does this function not work the way it should, or am I just not understanding the Lua documentation?

07-27-2007 09:08 AM
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: