• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with Random API

Status
Not open for further replies.
Looking over the given GetRandomReal, GetRandomInt and SetRandomSeed, I have questions.

Is the best solution to "undo" a SetRandomSeed call to just do another one with a random integer?

Is there any logic to the seeds (any reason to go high, low, negative, 0) or is any one of them fine?

Should the SetRandomSeed value be used dynamically in-game (should it be set periodically to keep things as random as possible)?
 
Level 15
Joined
Oct 16, 2010
Messages
942
Is there any logic to the seeds (any reason to go high, low, negative, 0) or is any one of them fine?

Just did some testing with seeds. I inputed these as a seed and then generated 80 random numbers for each:

0
5
-5
-9999
9999

There didn't appear to be any notable difference in the coverage of random numbers.

Should the SetRandomSeed value be used dynamically in-game (should it be set periodically to keep things as random as possible)?

It depends IMO. If you are just doing some basic gameplay stuff then there really isn't a reason too, but if your generating a random encryption or a save/load code or something then you probably want to make sure coverage is as unique as possible.

Is the best solution to "undo" a SetRandomSeed call to just do another one with a random integer?

I dunno :9

In java you create a random-type object and then assign the seed specifically to that object. However, I don't know how it's being done in jass and it appears that your solution would be the only way to do it.
 
Many thanks, information on the SetRandomSeed is very hard to come by.

It's not for a Save/Load code, it's just GetRandomInt has a big factor in my Pool project and I want to make sure it's working the way it's supposed to. I suppose I shouldn't bother shifting seeds around from that library itself as it should be up to the user to decide how random it should be.
 
Status
Not open for further replies.
Top