Hello,
In my app I’m using the math.randomseed function to set up the pseudo-random number generator to generate a consistent series of random numbers based on an initial input, such that the random sequence will be the same if the same input is given later.
In my tests I am finding that for a given seed, the number sequences are correctly identical between the simulator and iOS (or at least on my iPad). But on Android, the same seed will yield a different number sequence. Is this a bug? Is there a workaround?
-- seed the random number generator: math.randomseed( 144 ) -- generate a random number: local random\_number = math.random() -- display the number: local txt = display.newText( tostring( random\_number ), 0, 0, native.systemFont, 16 ) txt.x = display.contentWidth / 2 txt.y = display.contentHeight / 2 -- Oddly, the result is 0.94144149261594 on iOS and simulator, but 0.2109288313477 on Android
Thanks for any insight!
Bobby