dimanche 11 septembre 2016

Can a Java Random object give different results in different executions for the same seed?

Suppose you have a Java code in which you are using a Random object, initialized with a constant seed. In your code you use the Random object to generate different pseudorandom integers. You are not using multithreading. Is it possible to have different results in different executions of the code? For example, in case that the Java compiler deletes any redundant calls of the Random object in some random way in order to optimize the code, the execution will be different each time if you recompile the code.




Aucun commentaire:

Enregistrer un commentaire