FlxRandom, inconsistency when restarting a state
I'm currently using FlxRandom to generate the levels in my game. I'm not sure if I'm using it right, but if the user enters a seed, I set FlxRandom.initialseed to that number - I've also tried doing FlxRandom.currentseed.
The problem is that when I reset the state, it will consistently generate two different levels. So for instance, if we have level A and B (the two possible outcomes now, although I was hoping for only one), with every reset it will go : A,B,A,B,A,B,A,B. Sometimes it does some other pattern, but a pattern is always present.
So I ask, am I using FlxRandom wrong? Is there something I'm missing here?
According to the API, FlxRandom::initialSeed is used for recording and saving stuff. So you should only set FlxRandom::currentSeed for your level generation, and it has to be between 1 and 2,147,483,647.
If the problem still remains, I'll need to know how you use FlxRandom for that.
Yeah as I said I'm already using currentSeed and it still outputs the same result. I'm within boundaries.
Try dividing the problem into small sub-problems. You should look at the actual numbers generated by FlxRandom, and not at the levels
Do you mean this by
reset the state?
How do you use
FlxRandomto generate levels?
I've written a test case which generates 10 integer from the same seed and I get the same result every time I reset the state or switch it.