Different executions with different results using the same Random seed in LIBGDX

by user3313574   Last Updated September 12, 2016 08:05 AM

In my Libgdx project (for PC) I am using a Java Random object initialized with a constant seed. I use the Random object to generate a lot of different pseudorandom integers. I am not using multithreading, but the integers are a bit different each time I execute the application.

How can this be possible?

EDIT: What is really strange is that the Random object is called a few times more in some executions and I don't know why, causing the random numbers to be a bit different for each execution.

Tags : java libgdx random

Answers 1

If the number of RNG (Random Number Generator) calls changes depending on frame rate such as using the delta-time (animations, etc) to decide when to pull numbers out of the RNG you will get different results as the frame rate is unlikely to ever be the same between two runs.

Stephane Hockenhull
Stephane Hockenhull
September 11, 2016 22:29 PM

Related Questions

How to get this type of movement in LibGDX?

Updated May 20, 2015 20:05 PM

How to generate random terrain

Updated September 18, 2016 08:07 AM

Messy results from simple cellular automata algorithm?

Updated February 20, 2018 04:13 AM

Warning: Phalcon\Cache\Backend\File::save(/home/queryxchang/public_html/apps/frontend/config/../cache/-q-14-129796-different-executions-with-different-results-using-the-same-random-seed-in-libgdx-): failed to open stream: Disk quota exceeded in /home/queryxchang/public_html/public/index.php on line 37
Cache file /home/queryxchang/public_html/apps/frontend/config/../cache/-q-14-129796-different-executions-with-different-results-using-the-same-random-seed-in-libgdx- could not be written