Bug? Android Random Number Problems (using the same seed)

Hey everyone,

I’m having issues with generating random numbers on Android. Even when doing math.randomseed(*myseedhere*) and then doing math.random(), I get different results each time, even though the exact same seed is being used. This bug does not happen on the simulator or any iOS device. Those devices always report the same numbers when using the same seed each time.

I’ve tested this on 2 Android devices (Galaxy Tab and a Galaxy Nexus), and it still happened on both. Has anyone else had this problem, or have a fix for this bug? [import]uid: 51654 topic_id: 25311 reply_id: 325311[/import]

I’ve noticed the same bug for Corona on Android. [import]uid: 92621 topic_id: 25311 reply_id: 113690[/import]

I noticed this bug on build #934 on Android. On iOS randomseed works fine. [import]uid: 94304 topic_id: 25311 reply_id: 127381[/import]

I noticed this bug on build #934 on Android. On iOS randomseed works fine. [import]uid: 94304 topic_id: 25311 reply_id: 127381[/import]

Hey there-

Have you got a bug # I could pass on, please? [import]uid: 52491 topic_id: 25311 reply_id: 127625[/import]

It’s not a bug. Different platforms use different algorithms to generate a random number. There is no standard. A quick Internet search will show you that this is a problem that all cross-platform developers face. Even at the native C/C++ level.

If you want to generate a consistent/deterministic number between platforms, then you need to create your own algorithm in Lua. [import]uid: 32256 topic_id: 25311 reply_id: 127651[/import]

Hey there-

Have you got a bug # I could pass on, please? [import]uid: 52491 topic_id: 25311 reply_id: 127625[/import]

It’s not a bug. Different platforms use different algorithms to generate a random number. There is no standard. A quick Internet search will show you that this is a problem that all cross-platform developers face. Even at the native C/C++ level.

If you want to generate a consistent/deterministic number between platforms, then you need to create your own algorithm in Lua. [import]uid: 32256 topic_id: 25311 reply_id: 127651[/import]