I am creating a map that involves random distribution of heroes at the beginning and I am trying to figure out just how random galaxy's random numbers are. I understand that most computer random numbers are only pseudorandom, but I don't care as long as they are generally mostly random. My concern is that I feel like I've noticed a lot of "streaks" where the same people will get the same heroes 3-4 times in a row (from a group of 30). I have made sure that the random seed is not locked, so that is not my problem.
Thats exactly, what random is. Random involves streaks like that, if it did not have streaks, but was equally distributed, it would not be random.
This is a common misconception about randomness, most people consider a more equally distributed distribution to be more random than one, that involves clusters, while in reality, the latter one is the "real" random one.
If you want a more uniformed one, you can do that by applying special methods, for example reducing the chance to get already randomed heroes.
Randomness is achieved through preventing repetition in a cyclical or predictable fashion ó_ò
To know how good Sc2's randomness is we would have to know how they implemented it. Honestly I don't think their pseudo-random algorithm is very elaborate.
Bad algorithms tend to favor certain ranges or types of numbers more than they should. A good algorithm must not favor any kind of numbers.
Thanks for your replies. I have another question that is related to this. If I did decide that I was dissatisfied with SC2 random numbers, I imagine it wouldn't be terribly difficult to find a more powerful pseudorandom number algorithm to use instead. However, are there any thoughts on what I could use as a seed? I know the standard is usually number of clock cycles since a given time, but I somehow doubt SC is going to give me access to that. Obviously if I do go this route I won't want to rely on galaxy's built in random number generator since that would defeat the purpose entirely. Any thoughts?
Again, I don't think, that galaxy's random number generator is the problem here. Think of a dice: How likely would it be, to get the numbers from 1 to 6 for 6 rolls? Its much more likely, that some of the numbers are repeated.
Quote:
Randomness is achieved through preventing repetition in a cyclical or predictable fashion ó_ò
It prevents repetition in a predictable fashion, correct, but if a hero gets picked multiple times out of randomness, thats neither cyclic nor predictable. If, however, heroes would be randomly picked, but would be limited to one of a kind, thats way more predictable, isn't it?
Quote:
Bad algorithms tend to favor certain ranges or types of numbers more than they should. A good algorithm must not favor any kind of numbers.
Thats true, but I could not notice this behavior for SC2. Sure, there are streaks and repetitions from time to time, but I would be more suspicious, if this would absolutely never happen.
Also, I did read on multiple occasions, that WC3 had a quite good random algorithm, why should they implement a significantly worse one for SC2? (...okay, because they are Blizzard and they do such things ;) )
You could easily use the standard random function as base of a pseudorandom distribution. For example: If specific heroes are picked already, their chance of getting picked again gets reduced based on the number of times they were picked and a factor, specifying how likely multiple picks would be (in your case, a quite low one, I assume). Or, as mentioned, just be reduced to zero, so every hero will only be picked once. Should be fairly easy.
It prevents repetition in a predictable fashion, correct, but if a hero gets picked multiple times out of randomness, thats neither cyclic nor predictable. If, however, heroes would be randomly picked, but would be limited to one of a kind, thats way more predictable, isn't it?
Yea but that's random repetition and thus OK. There is no pattern in there to be seen.
Thats true, but I could not notice this behavior for SC2. Sure, there are streaks and repetitions from time to time, but I would be more suspicious, if this would absolutely never happen.
That's because you can't just notice that behavior most of the time.
For example, if you're taking random numbers between 1 and 10 it could be that you get a good distribution. While random numbers between 1 and 11 suddenly favors 1s and 2s.
Or maybe it favors odd numbers.
Or numbers that have a 1 as the 3rd bit in their binary representation (=4,5,6,7,12,13,14,etc).
Some of these cases are very nitpicky, some aren't.
Usually the reason to implement a worse RNG is because they are faster and the results don't need to be very random.
In a video game who cares if some numbers are slightly favored over others - it's not like you could abuse it.
I am creating a map that involves random distribution of heroes at the beginning and I am trying to figure out just how random galaxy's random numbers are. I understand that most computer random numbers are only pseudorandom, but I don't care as long as they are generally mostly random. My concern is that I feel like I've noticed a lot of "streaks" where the same people will get the same heroes 3-4 times in a row (from a group of 30). I have made sure that the random seed is not locked, so that is not my problem.
Thats exactly, what random is. Random involves streaks like that, if it did not have streaks, but was equally distributed, it would not be random.
This is a common misconception about randomness, most people consider a more equally distributed distribution to be more random than one, that involves clusters, while in reality, the latter one is the "real" random one.
If you want a more uniformed one, you can do that by applying special methods, for example reducing the chance to get already randomed heroes.
Randomness is achieved through preventing repetition in a cyclical or predictable fashion ó_ò
To know how good Sc2's randomness is we would have to know how they implemented it. Honestly I don't think their pseudo-random algorithm is very elaborate.
Bad algorithms tend to favor certain ranges or types of numbers more than they should. A good algorithm must not favor any kind of numbers.
@s3rius: Go
I've noticed the same thing before. But as far as I know, there's no way to tell. Unless you go and take a look at how they coded it.
Thanks for your replies. I have another question that is related to this. If I did decide that I was dissatisfied with SC2 random numbers, I imagine it wouldn't be terribly difficult to find a more powerful pseudorandom number algorithm to use instead. However, are there any thoughts on what I could use as a seed? I know the standard is usually number of clock cycles since a given time, but I somehow doubt SC is going to give me access to that. Obviously if I do go this route I won't want to rely on galaxy's built in random number generator since that would defeat the purpose entirely. Any thoughts?
Again, I don't think, that galaxy's random number generator is the problem here. Think of a dice: How likely would it be, to get the numbers from 1 to 6 for 6 rolls? Its much more likely, that some of the numbers are repeated.
It prevents repetition in a predictable fashion, correct, but if a hero gets picked multiple times out of randomness, thats neither cyclic nor predictable. If, however, heroes would be randomly picked, but would be limited to one of a kind, thats way more predictable, isn't it?
Thats true, but I could not notice this behavior for SC2. Sure, there are streaks and repetitions from time to time, but I would be more suspicious, if this would absolutely never happen.
Also, I did read on multiple occasions, that WC3 had a quite good random algorithm, why should they implement a significantly worse one for SC2? (...okay, because they are Blizzard and they do such things ;) )
You could easily use the standard random function as base of a pseudorandom distribution. For example: If specific heroes are picked already, their chance of getting picked again gets reduced based on the number of times they were picked and a factor, specifying how likely multiple picks would be (in your case, a quite low one, I assume). Or, as mentioned, just be reduced to zero, so every hero will only be picked once. Should be fairly easy.
Yea but that's random repetition and thus OK. There is no pattern in there to be seen.
That's because you can't just notice that behavior most of the time.
For example, if you're taking random numbers between 1 and 10 it could be that you get a good distribution. While random numbers between 1 and 11 suddenly favors 1s and 2s.
Or maybe it favors odd numbers.
Or numbers that have a 1 as the 3rd bit in their binary representation (=4,5,6,7,12,13,14,etc).
Some of these cases are very nitpicky, some aren't.
Usually the reason to implement a worse RNG is because they are faster and the results don't need to be very random.
In a video game who cares if some numbers are slightly favored over others - it's not like you could abuse it.