ID:156247
 
Is it possible to get the seed from the system clock that is being used in the rand procs?
I think not. But why would you need to do that? Only for testing purposes, I guess.
In response to Kaioken
There are many uses for acquiring the seed value for a number sequence. There are many cool things you can do if you can get a pseudo-random number sequence but repeat it at will. Map generation is the first thing that comes to mind, and it's probably the most common. Likewise, anything else where you want something produced for you and to be reproducible.
In response to Loduwijk
Loduwijk wrote:
There are many uses for acquiring the seed value for a number sequence. There are many cool things you can do [...]

I'm well aware, but you don't need BYOND to have a get_current_rand_seed() proc to do that at all, since we already have rand() and rand_seed(), which, together, allow you to accomplish the same effect.
As Kaioken said, no. At least not directly. You could get a random number, record it, use it to (re)seed the generator, then use it from there and you know what the seed is.

If you wanted many different number sequences that were all repeatable, you could even store a bunch of them from the initial sequence.
var/list/sequenceSeeds[100]
proc/genSequences()
for(i = 1 to sequenceSeeds.len)
sequenceSeeds[i] = rand(1, MAX_VALUE)

Then you have 100 different reproducible (predetermined) pseudo-random number sequences. Just grab one of the values from sequenceSeeds and (re)seed the generator again and keep track of which one you used.
In response to Kaioken
I wanted a get_current_rand_seed() proc for map generation, even though the same desired effect can be achieved otherwise, I was too lazy to code it. Since then, I have coded it though, works fine. Thanks for popping in :)
In response to Loduwijk
Loduwijk wrote:
As Kaioken said, no. At least not directly. You could get a random number, record it, use it to (re)seed the generator, then use it from there and you know what th...

Thanks for this. That's pretty much how I did it too, it just would've been nice if an internal proc handled it all instead ;)
In response to Kaioken
Kaioken wrote:
I'm well aware, but you don't need BYOND to have a get_current_rand_seed() proc to do that at all, since we already have rand() and rand_seed(), which, together, allow you to accomplish the same effect.

Yes of course, I didn't mean that. Other languages don't have such a function either that I'm aware of. For example, C++ has the equivalent of our random and seed-random functions, but if it has a function for getting the current one, I'm not aware of it. So you generally do the same thing in these languages as well, except the part where I suggested using the current sequence to generate the seeds for the other sequences, since many other languages seed the generator with a constant rather than the time, so you want to initially seed them properly yourself as well.

Also, if you know the algorithm used for the generator (I'd assume modular division for Byond), obviously you can figure out the seed on your own by generating a bunch of numbers and analyzing them. I won't suggest that to the OP though. ;)