Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Advanced Randomization
Advanced Randomization
Nov 25 2009, 10:53 am
By: JaFF
Pages: 1 2 3 >
 

Nov 25 2009, 10:53 am JaFF Post #1



Old Thread


Some people asked about producing a random number within some range. Behold, the Uniform Randomizer! It gives you a value between 0 and 999 each trigger loop. Uses up only 3 deathcounters and 1 switch. The amount of triggers can be lowered for practical purposes by about... 160. This is just I something I made in 30 minutes to demonstrate one of the possible ways to do it (and, probably the easiest one). If you run the map, you'll see that it gives you a kind of histogram - a set of points on the xy plane. Each point moving up represents a hit on a value within 10 units (0 to 9, 10 to 19, etc.).

This allows you to make quite accurate distributions with 0.05% accuracy. Anyone tempted to make a 'horse race' map where you have to bet depending on the conditions? :P

Post has been edited 7 time(s), last time on Dec 22 2009, 11:05 pm by JaFF.



None.

Nov 25 2009, 3:07 pm The Starport Post #2



Hmm. Is this the one where you need about a dozen triggers to re-randomize each time you need to use it?

I think I've used this before...



None.

Nov 25 2009, 3:11 pm JaFF Post #3



Quote from name:Tuxedo-Templar
Hmm. Is this the one where you need about a dozen triggers to re-randomize each time you need to use it?
If you mean the randomization with one switch, then yes. You re-randomize it many times and add consecutive powers of 2 if it is set each time.



None.

Nov 25 2009, 4:50 pm Moose Post #4

We live in a society.

Has anyone actually collected data on both one-switch randomization and many-switch randomization to see if they provide roughly the same samples?




Nov 25 2009, 4:56 pm JaFF Post #5



Quote from Mini Moose 2707
Has anyone actually collected data on both one-switch randomization and many-switch randomization to see if they provide roughly the same samples?
Not that I know of. This map does show that one-switch randomization is truly unbiased, though.

EDIT:
Just finished testing it. I tried randomizing the switches in the same trigger and in separate ones. The results strongly suggest that those kinds of randomization are also unbiased. I guess this should convince those who thought that there's something wrong with the SC randomization engine (me among them!).

Post has been edited 1 time(s), last time on Nov 25 2009, 5:24 pm by JaFF.



None.

Nov 25 2009, 5:29 pm CecilSunkure Post #6



I use probability generators, or at least a form of them, within my RPG. I use them for "invisible dice rolls", pertaining to strength, constitution, and some other types of checks, during gameplay.

I just use single switch randomization using amounts of DCs that fill the equation 2^(x-1). Depending on the character's level, the parameters for a successful roll raise or lower. I believe I use 200 DC's, (meaning 200 outcomes of the dice).

My system used 3 DCs and 1 switch (though I preferred to use multiple switches). The 3 DCs were: the outcomes, the DC used to represent character levels of a certain attribute, and the DC representing a successful/unseccessful check.

[Edit]Also, what's the Bernoulli Variable exactly? Just true of false, as in boolean? Never mind.

Post has been edited 1 time(s), last time on Nov 25 2009, 5:41 pm by CecilSunkure.



None.

Nov 26 2009, 5:19 am Falkoner Post #7



I'm assuming you're using this kind of randomization, and it shouldn't be any less random, you still randomize switches several times, if anything I think it'd be slightly more random due to a longer delay between randomizations.



None.

Nov 26 2009, 5:25 am CecilSunkure Post #8



If you meant me Falk, that's pretty much what I used.



None.

Nov 26 2009, 7:30 am Kenoli Post #9



Quote
I guess this should convince those who thought that there's something wrong with the SC randomization engine (me among them!).
Just because it's a rudimentary pseudo-random number generator doesn't mean it can't produce output with convincingly good statistics!
Fortunately the need for anything better is probably beyond the scope of mapmaking, and any sort of meaningful test for randomness is impractical at best.

I typically just randomize to some arbitrary high value to minimize whatever bias using a power of 2 might have on the outcome.
349525 isn't exactly a third of 1048576, but hey close enough.



None.

Nov 26 2009, 10:31 am JaFF Post #10



Quote from Kenoli
I typically just randomize to some arbitrary high value to minimize whatever bias using a power of 2 might have on the outcome.
349525 isn't exactly a third of 1048576, but hey close enough.
This is exactly what this map does, except it uses 2^15. I tried making it more applicable and user-friendly: the person using it only has to enter one value and not worry about the rest.



None.

Nov 26 2009, 5:01 pm Falkoner Post #11



Of course, doesn't that mean the system has to loop more times depending on how high the number you enter is?



None.

Nov 26 2009, 5:03 pm The Starport Post #12



More copied triggers, yes. But not much more, considering it's binary.

Another thing that makes MacroTriggers useful. :P



None.

Nov 30 2009, 12:24 am scwizard Post #13



How did I not see this until today?

This is extremely interesting and relevant to my current mapping endeavors.



None.

Dec 3 2009, 12:57 pm rockz Post #14

ᴄʜᴇᴇsᴇ ɪᴛ!

nothing is ever truly random according to my teacher.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Dec 3 2009, 1:29 pm JaFF Post #15



Quote from rockz
nothing is ever truly random according to my teacher.
Yup. We just say 'random' when we are supposed to say 'pseudo-random' just to save space. :P



None.

Dec 3 2009, 3:54 pm Kenoli Post #16



Quote
nothing is ever truly random according to my teacher.
Determinism is silly.



None.

Dec 3 2009, 4:03 pm rockz Post #17

ᴄʜᴇᴇsᴇ ɪᴛ!

indeed, but I don't think that's what he meant (he's my circuits teacher). It was more along the lines of randomizing a bit is still just pseudo-random.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Dec 3 2009, 4:16 pm Kenoli Post #18



I guess that depends on the methods used.



None.

Dec 14 2009, 12:54 am scwizard Post #19



I'm sort of embarrassed to say I don't understand how this is working :/

How would it, for instance, randomly generate a number from 1 to 3? Anyone care to walk me through this map?

How many cycles would it take to do this?



None.

Dec 14 2009, 1:28 am CecilSunkure Post #20



Quote from scwizard
I'm sort of embarrassed to say I don't understand how this is working :/

How would it, for instance, randomly generate a number from 1 to 3? Anyone care to walk me through this map?

How many cycles would it take to do this?
You use what is called single switch randomization -although I usually just use a bunch of different switches. The point is, to have a 50% chance to add amounts of DC's that satisfy the equation of 2^(x-1). Here is an example of randomizing from 0-15 within a single trigger cycle:

Quote
Conditions:
Always

Actions:
Set DC to 0
Randomize switch 1
Randomize switch 2
Randomize switch 3
Randomize switch 4


Conditions:
Switch 1 is set

Actions:
Add 1 DC


Conditions:
Switch 2 is set

Actions:
Add 2 DCs


Conditions:
Switch 3 is set

Actions:
Add 4 DCs


Conditions:
Switch 4 is set

Actions:
Add 8 DCs
So now, each of these triggers will have a 50% chance of firing due to the Bernoulli variable of true or false being randomized for each trigger in the countoff. This means, that the chance of each switch being set is (1/2)^(4), or in other words, 1/16; every number ranging from 0-15 will have an equal chance of being landed on.

If you want a nice number like 0-100 to be randomized, you aren't going to have equal odds, because the last number to be added in the countoff won't fill the equation of 2^(x-1), where x represents a trigger in a countoff sequence. This means that it is best to randomize amounts that fill the equation of 2^(x-1) in order to achieve equal probabilities of all outcomes.

So say I want to randomize between 0-10. Well, the addition numbers would be 1, 2, 4, and 3. With these numbers to be added, you can land on 7 two different ways: 1 + 2 + 4; 3 + 4. The odds aren't even because the last number to be added in the countoff does not satisfy the aforementioned equation.



None.

Options
Pages: 1 2 3 >
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[07:46 am]
RIVE -- :wob:
[2024-4-22. : 6:48 pm]
Ultraviolet -- :wob:
[2024-4-21. : 1:32 pm]
Oh_Man -- I will
[2024-4-20. : 11:29 pm]
Zoan -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
You should do my Delirus map too; it's a little cocky to say but I still think it's actually just a good game lol
[2024-4-20. : 8:20 pm]
Ultraviolet -- Goons were functioning like stalkers, I think a valk was made into a banshee, all sorts of cool shit
[2024-4-20. : 8:20 pm]
Ultraviolet -- Oh wait, no I saw something else. It was more melee style, and guys were doing warpgate shit and morphing lings into banelings (Infested terran graphics)
[2024-4-20. : 8:18 pm]
Ultraviolet -- Oh_Man
Oh_Man shouted: lol SC2 in SC1: https://youtu.be/pChWu_eRQZI
oh ya I saw that when Armo posted it on Discord, pretty crazy
[2024-4-20. : 8:09 pm]
Vrael -- thats less than half of what I thought I'd need, better figure out how to open SCMDraft on windows 11
[2024-4-20. : 8:09 pm]
Vrael -- woo baby talk about a time crunch
[2024-4-20. : 8:08 pm]
Vrael -- Oh_Man
Oh_Man shouted: yeah i'm tryin to go through all the greatest hits and get the runs up on youtube so my senile ass can appreciate them more readily
so that gives me approximately 27 more years to finish tenebrous before you get to it?
Please log in to shout.


Members Online: Wing Zero, IlyaSnopchenko, jun3hong