I am experiencing this as well (Galaxy S2, Corona 2012.840). To test this, I wrote the following program:
[lua]math.randomseed(12345)
–generate some random numbers to make sure not only the first, but also the upcoming numbers are properly randomised.
for i = 1, 100 do
print(math.random(1,100))
end
local myText = display.newText( math.random(1,100), 0, 0, native.systemFont, 40 )
myText.x = display.contentWidth / 2
myText.y = display.contentWidth / 2
myText:setTextColor( 255,110,110 )[/lua]
However, with this program, everything worked as it should. The numbers was the same every time I ran the program (even though the numbers was not the same as on Windows and iOS devices).
In my real application however, I get different random numbers every time I run it, even if math.randomseed is set as above and only once (always before math.random is called). This problem does only occur on Android. There must be something in the code making math.random behaving unintentionally, but I can not see the logical explanation to what and why this is happening.
Another issue I have with math.random is that the random numbers on Windows simulator are different than those from Xcode and iOS. Note that the random numbers on the Windows simulator are the same when relaunching the application, unlike the issue I explained above.
Edit: Mentionable that I am using Android 4.0.3. [import]uid: 91236 topic_id: 25196 reply_id: 113391[/import]