|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||||||||||||
|
|
|
|
|
||||||||||||||||||
|
|
|
|
|||||||||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||||
|
|
|
|
|
|
|
||||||||||||||||
![]() |
|
|
|
||||||||||||||||||
![]() |
![]() |
|
|||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||
![]() |
![]() |
|
|||||||||||||||||||
|
|
|
||||||||||||||||||||
|
|||
|
Ok, so its not exactly true per se, but its more random than using the default seed, 0. If you were not initialize the seed, you would get a set of "random numbers" that would repeat after a few thousand iterations. If you use a seed (being the time), you make it so you spit out a different sequence of "random numbers", which change with the time. In essence, none are truly random, but for our use, initializing the random seed as the time does enough.[addsig]
__________________
Homebrew Dev |
|
|||
|
sounds good..... what if you passed (as seed) a call to the random number generator with os.time() as its seed into the random number generator function. as in.... [code=lua]Math.randomseed(Math.randomseed(os.time()))[/code] that number would probably be pretty random..... would it even work? dunno, never used LUA. [addsig]
__________________
I am who I am because of who everyone around me is. Moderator @ [Only Registered Users Can See Links. Click Here To Register] [Only Registered Users Can See Links. Click Here To Register] |
| Sponsored Links |
|
|||
|
Hey, thanks for the information on math.randomseed(). I have learned about the function ever since I posted this tutorial, I will make an update to this guide soon.
Calling math.randomseed() inside another math.randomseed() I think wouldn't work. I have tested it and if I call: [code=lua]math.randomseed (math.randomseed (os.time()))[/code] LUA Player produces an error saying that it excepted a number and got no value. So I would assume that math.randomseed() doesn't produce a number, and therefore cannot be used within another math.randomseed(). I only tested it on LUA Player version 0.20 so I don't know if it would work differently for other LUA Player versions or not.[addsig] |
| Sponsored Links |
|
||||
|
Quote:
Wow, this is looking really complicated now.....[addsig]
__________________
If you have nothing with you, the best entertainment system out there is your imagination. If I\'m offline, leave a message after the snot bubble. email me at [Only Registered Users Can See Links. Click Here To Register] if you have any questions. I\'ll try to answer them.
|
![]() |
| Tags |
| lua, mathematics |
| Thread Tools | |
| Display Modes | |
|
|