math.randomseed()

Moderator: Moderator

Post Reply
Message
Author
Lap
Cornac
Posts: 40
Joined: Sun Aug 29, 2010 1:31 am

math.randomseed()

#1 Post by Lap »

math.randomseed(os.time())

Should probably be included in the base code of the T-Engine every time it starts, otherwise you have to manually add it to each module so you don't get the same random numbers every start up.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: math.randomseed()

#2 Post by darkgod »

No, you do not want to use math.random at all.
Use the rng.* functions, they are correctly inited and use a mersene twister which makes much better random numbers than the default OS rand()
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: math.randomseed()

#3 Post by yufra »

There are a few calls to math.random from the thirdparty modules, anything in there that is sensitive to non-randomness?
<DarkGod> lets say it's intended

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: math.randomseed()

#4 Post by darkgod »

True .. I'll include the init just in case :)

Still for your own code use rng.*
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Shoob
Reaper
Posts: 1535
Joined: Mon Jan 22, 2007 6:31 pm
Location: East of the sun, west of the moon

Re: math.randomseed()

#5 Post by Shoob »

perhaps it would be better to say here is a list of rng.* functions you can use, rather than say use them... as some people may not know all of them... and it is easier to find the math.* stuff because it is written down online.
Oliphant am I, and I never lie.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: math.randomseed()

#6 Post by yufra »

That reminds me, is there any way to include documentation of the C functions exposed to Lua with the LuaDoc generated documentation?
<DarkGod> lets say it's intended

Post Reply