java - Initiating a second Random object using the same seed -
using seed can random object spit same sequence of numbers on , on again. if want shut down app, relaunch , continue spitting numbers left off? initiating new random same seed starts sequence again.
so.. apart maintaining list of calls made random , re-calling them same position, there better way?
edit: zim-zam has pointed out using java serialization reinitiate object don't want add single java object save files otherwise entirely xml.
you can serialize random
object objectoutputstream
save state; when start program again, deserialize objectinputstream
, random
start left off.
alternatively, copy-paste java random source code own myrandom
generator; give access internal workings of generator can save , restore state.
Comments
Post a Comment