The game I'm working on has a random 2d level generator. The subrutine, that creates the level, accepts a (long) argument that if not zero, uses that value as the random seed. I have some numbers (seeds) that create some interesting levels. So when I use the number zero, it doesn't set the seed, and just leaves the "default" seed alone. I have seen some pretty interesting levels generated this way as well. My question is: Is there a way to get the current seed that the random generator is using (when I have not specifically set one)? I believe if I could get this number then I could virtually use this as the level ID number and allow players to use the same "random" level over and over.

If no seed (not zero) is provided, I just randomly randomize the seed. The subrutine is now a function that returns the seed, so I can store it in a value, so the players can request the "ID" of the level.

If you leave the seed field blank, the game will use the time (computer clock) as a seed. Leaving the seed field blank will not produce the same map every time. Using seed 0 in singleplayer will also be ignored, as though it were left blank.

If you leave the seed field blank, the game will use the time (computer clock) as a seed. Leaving the seed field blank will not produce the same map every time. Using seed 0 in singleplayer will also be ignored, as though it were left blank.

I just thought that if you dont even call .setSeed(seed);, using System.currentTimeMillis() or something similar is the default behavior.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org