Page 1 of 1
[0.12.33] math.randomseed( int ) doesn't work/register
Posted: Thu May 26, 2016 4:31 pm
by MrDoomah
The outputs aren't the same as they should:

Re: [0.12.33] math.randomseed( int ) doesn't work/register
Posted: Thu May 26, 2016 4:37 pm
by daniel34
viewtopic.php?f=25&t=19353#p123629
Oxyd wrote:Ranakastrasz wrote:Alright. What about the seed? Do I have to initilize it to get different results per game? Do I have to do it on game-load? If i do it on game load, will it sync over all players?
You can't seed the generator from Lua. There is one random number generator for each map – used both by the game itself and by Lua's math.random. This generator is seeded when the map is generated – there's an input box on the map generator screen when starting a new game that lets you specify the random seed.
Re: [0.12.33] math.randomseed( int ) doesn't work/register
Posted: Thu May 26, 2016 4:47 pm
by orzelek
This is main reason (I think - dark wrote it) why RSO uses separate random generator made in lua to provide proper ore regeneration.
It could use the built in one now but you wouldn't be able to regen the ores and get same result since there is no way to seed it.
It would be nice actually to have ability to instantiate our own random gen through lua.
Re: [0.12.33] math.randomseed( int ) doesn't work/register
Posted: Thu May 26, 2016 4:59 pm
by daniel34
orzelek has made a request:
Creation of separate random generators [Modding interface requests]
I think this should stay in 'Not a bug' as Factorio just works that way and reseeding the RNG wasn't planned.
orzelek wrote:It could use the built in one now but you wouldn't be able to regen the ores and get same result since there is no way to seed it.
Given that the ores already regenerate randomly (depending on the map seed), why would you need to get the same result when calling it twice?
Re: [0.12.33] math.randomseed( int ) doesn't work/register
Posted: Thu May 26, 2016 5:13 pm
by MrDoomah
Fine! I'll build my own RNG! With blackjack and hookers!
Joking aside, I get the reason and I'll find a solution

Re: [0.12.33] math.randomseed( int ) doesn't work/register
Posted: Fri May 27, 2016 11:47 pm
by MrDoomah
For anyone else needing a seed-able rng:
viewtopic.php?f=96&t=25797