This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes Random seed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Random seed" Watch "Random seed" New topic
Author

Random seed

Matti Poro
Ranch Hand

Joined: Dec 03, 2005
Posts: 41
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

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
 
Consider Paul's rocket mass heater.
 
subject: Random seed