[0.12.33] math.randomseed( int ) doesn't work/register

Bugs that are actually features.
Post Reply
MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

[0.12.33] math.randomseed( int ) doesn't work/register

Post by MrDoomah »

Image

The outputs aren't the same as they should:
Image

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [0.12.33] math.randomseed( int ) doesn't work/register

Post 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.
quick links: log file | graphical issues | wiki

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [0.12.33] math.randomseed( int ) doesn't work/register

Post 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.

daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [0.12.33] math.randomseed( int ) doesn't work/register

Post 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?
quick links: log file | graphical issues | wiki

MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

Re: [0.12.33] math.randomseed( int ) doesn't work/register

Post by MrDoomah »

Fine! I'll build my own RNG! With blackjack and hookers! :twisted: :roll:

Joking aside, I get the reason and I'll find a solution ;)

MrDoomah
Fast Inserter
Fast Inserter
Posts: 196
Joined: Mon Jun 01, 2015 1:11 pm
Contact:

Re: [0.12.33] math.randomseed( int ) doesn't work/register

Post by MrDoomah »

For anyone else needing a seed-able rng: viewtopic.php?f=96&t=25797

Post Reply

Return to “Not a bug”