Random Number

Lyle.

New Member
Reaction score
32
No, that's wrong. It will almost certainly make the outcome less random (formally: it will have less entropy).

For example, the sum of two rolls of a dice is more likely to be 7 than 12. It is less random than a uniform random number from 2 to 12.



If you want to *avoid* bursts of critical hits (or whatever), you need to make the probability of getting a critical hit lower if the last hit (or last couple hits) were criticals. In the extreme case you could give a critical hit exactly every 5 swings. A viable solution might that each swing deducts 1 from a count, when the count hits 0 you get a critical, and then the count resets to a random number from 2 to 10 (or whatever).

Yay real suggestions : )

Thanks, those are both viable solutions and I might default to those but at this point I want to give this "More" random number more time. Somebody's gotta know something :D?
 

Volkof

Well-Known Member
Reaction score
31
I was just wondering if the World Editor provides a function which lets you get the current microsecond of the computer time.

If it can be done, you can use that value for random number. Just a thought


Cheerio
 

Chao

Setting sail for fail in the sea of lame.
Reaction score
63
Yay real suggestions : )

Thanks, those are both viable solutions and I might default to those but at this point I want to give this "More" random number more time. Somebody's gotta know something :D?

Hey there.

What I use is an arrayed variable called Gamble.
You set up another trigger that is just
Event: "Every 0.03 seconds of gametime"
Set: "Gamble=random number from X to Y"

Then instead of plugging in a white-bread random number, you're plugging in a number that you could never predict. X and Y can be programmed in every ability, if you'd like two numbers that are a little "off the beaten path". You might have to add a little wait-time to your ability, or if there's already some, that's for the best; I don't leave this trigger on. I turn it off and then back on as necessary. Hope that helps!
 

Strilanc

Veteran Scripter
Reaction score
42
Code:
A = Random(1,100)
B = Random(1,100)
C = Random(1,100)
D = Random(1,100)
E = Random(1,100)
X = (a+b+c+d+e)/5

is not much random, this is random in the case you need "50" to be the most appearing number (there are much more possibilities to have 50 in that case than 1 or 100)


I'm pretty sure you meant 150. Fix your typo.

Hey there.

What I use is an arrayed variable called Gamble.
You set up another trigger that is just
Event: "Every 0.03 seconds of gametime"
Set: "Gamble=random number from X to Y"

Then instead of plugging in a white-bread random number, you're plugging in a number that you could never predict. X and Y can be programmed in every ability, if you'd like two numbers that are a little "off the beaten path". You might have to add a little wait-time to your ability, or if there's already some, that's for the best; I don't leave this trigger on. I turn it off and then back on as necessary. Hope that helps!

How is this any different from just calling (random from X to Y) directly? :rolleyes:
 

Moon_Raven

New Member
Reaction score
8
Does that actually help? Can anyone explain this logically to me if it does in fact work o_O


Otherwise I will try to make my own, I'm sure there is a usable algorithm out there some where :)

You won't get a random algorithm anywhere! Computers can't make random numbers! When you use GetRandomNumber(1,100), the computer already has a sequence of many many numbers betweeen 1 and 100 and with average sum of 50 in it. Now the only thing is the seed, it's where should the computer begin in that sequence. And since I don't think there is an option to set seed tot a number you want, you won't make more random numbers.
 

Strilanc

Veteran Scripter
Reaction score
42
You won't get a random algorithm anywhere! Computers can't make random numbers! When you use GetRandomNumber(1,100), the computer already has a sequence of many many numbers betweeen 1 and 100 and with average sum of 50 in it.

:banghead:
That is completely misleading. The computer doesn't have a fixed sequence of numbers stored anywhere. What it has is an algorithm (wc3 probably uses a linear congruential generator) which defines a massive sequence of numbers, and it reduces the generated values to the range you specify.

Also, the whole "computers can't generate random numbers" thing is ridiculous. First: it's not even true. Computers have access to plenty of entropy. Second: even if it was true, it wouldn't matter in this case. Just seeding the generator with the time is enough to make it too hard for a person to predict the next value.
 

Moon_Raven

New Member
Reaction score
8
What I said IS true. Of course computer CAN'T generate random numbers. And I diddn't say they have a sequence of numbers stored somewhere at all times, but the wc3 probably makes one when you put anything in you map which uses GetRandomInt, how would you make the "Use fixed random seed" work if it wasn't like that?
 

Strilanc

Veteran Scripter
Reaction score
42
What I said IS true. Of course computer CAN'T generate random numbers. And I diddn't say they have a sequence of numbers stored somewhere at all times, but the wc3 probably makes one when you put anything in you map which uses GetRandomInt, how would you make the "Use fixed random seed" work if it wasn't like that?

Computers can generate random numbers because they have access to entropy (random data). For example they can use network delays, user input, the temperature of some components, etc.

The idea that computers can't generate random numbers is a simplification of reality. In practice you need random numbers faster than you can collect entropy, so programs stretch out entropy using a PRNG. But that still doesn't mean the output is non-random. A deterministic process seeded with a random value doesn't have a deterministic output, it has a random output!

WC3 doesn't require cryptographically secure random numbers, so it (correctly) doesn't bother adding entropy over time. (Note: user actions have an effect on when values are generated, and this is a source of entropy. So even if you know the initial seed and current game time, you don't know enough to predict if the next hit will be a critical. So I guess technically wc3 *does* add entropy over time, but it's purely a side effect of its use.)
 

Lyle.

New Member
Reaction score
32
Like I said, The solution Darthfet led me too is quite sufficient so my problem is solved.

You won't get a random algorithm anywhere! Computers can't make random numbers! When you use GetRandomNumber(1,100), the computer already has a sequence of many many numbers betweeen 1 and 100 and with average sum of 50 in it. Now the only thing is the seed, it's where should the computer begin in that sequence. And since I don't think there is an option to set seed tot a number you want, you won't make more random numbers.

http://en.wikipedia.org/wiki/List_of_random_number_generators

Yes you can get Random number algorithms...? How do you think it WC3 has a Random Number Function? Of course they are not true Randoms but I already mentioned they can't be :)


EDIT: Quoted an old post there but Strilanc is right there are ways to create Random Numbers with computers. At the same time even when you take Temperature, Time of Day and Input you arn't creating a True Random : )
 

Moon_Raven

New Member
Reaction score
8
Yeah, I know they can use things such as last digits of miliseconds of current time and such things. But that will STILL not be random if you attack with a constant speed etc. And if you think wc3 does add entorpy over time, how would you explain the use of Use Fixed Random seed?

And to conclude this, computers CAN'T be random :)
 

Strilanc

Veteran Scripter
Reaction score
42
Yeah, I know they can use things such as last digits of miliseconds of current time and such things. But that will STILL not be random if you attack with a constant speed etc. And if you think wc3 does add entorpy over time, how would you explain the use of Use Fixed Random seed?

And to conclude this, computers CAN'T be random :)

You're not making a lot of sense. What does "Use Fixed Random seed" have to do with user input adding entropy? The number of random numbers generated depends on user input whether, regardless of the seed.

The time is a poor source of entropy, which is why I didn't mention it. Let me elaborate on one of the examples I did mention: user input. The amount of time between key presses varies, obviously. The variations might be small, but they are still there. More importantly, no one can predict those variations exactly. Not even you, the typist. If the computer accurately measures those variations, it can use the low-order bits as a source of random data.

You can even use many poor sources of random data, apply privacy amplification, and get very good random data out of it.

In short, I don't think you know what you're talking about. It sounds like you read a discussion somewhere where someone said computers can't make random numbers because they have to follow rigid instructions, but they left out the part where the input could vary.
 

Moon_Raven

New Member
Reaction score
8
Ok, sorry about that, but what ever entropy you use, numbers are STILL not random, and you know it...
 

DarkSonicele

New Member
Reaction score
20
Moon Raven is somewhat right here, and so are you. In our interpretation of the world, random cannot exist as there is always a scheme for anything. If the computer use temperature of components, monitor size and sound height to make a random number there will still be a very complex scheme behind.
But as these things are so close to being random as they are, we have to name them "random" to easier explain the overall term.

TL;DR answer: Just shut up and get back on topic.

The numbers generated through the warcraft 3 number generator are most of the time random, but as random is, well, random it can occur that it will come as burst, sometimes often sometimes not. It's magic of the random number generator systems :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top