• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Random seed

 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do Random-objects with the same seed give the same values every time, on every computer and on every Java Virtual Machine implementation (>=JRE 1.5)?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the API, yes. "Java implementations must use all the algorithms shown here for the class Random, for the sake of absolute portability of Java code. However, subclasses of class Random are permitted to use other algorithms, so long as they adhere to the general contracts for all the methods." So as long as you use an actual Random and not a subclass you should be fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic