randomization
This topic is locked. You can no longer write replies here.
Jul 27 2009, 4:29 am
By: Exigence  

Jul 27 2009, 4:29 am Exigence Post #1



i did a search on how to do randomization... and i found out what i wanted to know from a previous post.
(5 Switches: 32 Outcomes) using a multi-switch randomization

what i couldn't seem to find was how to find those outcomes without losing my mind :flamer:
i was able to figure out 4 switches (with 16 outcomes) but i'm not sure i can do the same with 32 outcomes lol.
i couldn't seem to find the answer i was looking for. just "how" the randomization works.



None.

Jul 27 2009, 4:38 am CecilSunkure Post #2



http://mapmaking.myfastforum.org/about26.html

I wrote that tutorial, hope it helps!

BTW, read the final way, not the first 2.



None.

Jul 27 2009, 4:39 am Falkoner Post #3



Count in binary, it makes it easier:
0, 1, 01, 10, 11, 100, 101, 110, 111 and so on, every time a column fills up, you carry it to the next column and start back at the first column.

Of course, for very large numbers, I would highly recommend Single Switch Randomization, it only requires one switch, and it stores the random number in a Death Count, allowing you to use the At Least and At Most conditions too with your random outcomes.



None.

Jul 27 2009, 5:00 am Exigence Post #4



hmm i don't understand how the Single Switch Randomization actually works... i tried to read it more than a couple times. to my understanding, when the switch is set, the deathcount would keep adding up :wtfage: i have no clue what conditions my triggers should meet in that case.. maybe i should just keep reading it over? lol
.. and yes CecilSunkure, your tutorial was helpful



None.

Jul 27 2009, 5:14 am Falkoner Post #5



Yeah, it took me a long time to get it myself, but now I realize it's probably the best randomization system.

The way I showed it is so that you can do your randomization in a single loop, so what happens is the switch gets rerandomized in between detections of whether it's set or cleared, and then you double the amount you add to the death count every time, starting at 1, here, I'll run through how it would work once, to help explain it, to get a random number 0-7

Switch is randomized, it is now Set.
Since it's set, 1 is added to the Death, it's currently at 1.
Switch is randomized, it is now Cleared.
Since it's cleared, nothing happens. If it was set 2 would be added to the Death, but it isn't in this case.
Switch is randomized, it is now Set.
Since it's set, 4 is added to the Death, it's currently at 5.

And now you have your random number, those triggers give 8 possible outcomes, but you have to remember that it's 0-7, not 1-8.



None.

Jul 27 2009, 5:31 am Exigence Post #6



hmm. it still isn't clicking to me. every tutorial you've written is very well explained, but how this works isn't making any sense to me. :( do you reset the count to 0 after the randomization is made? if it doesn't, how is the randomization able to be preserved for future use of it?



None.

Jul 27 2009, 5:35 am CecilSunkure Post #7



Quote from Exigence
hmm. it still isn't clicking to me. every tutorial you've written is very well explained, but how this works isn't making any sense to me. :( do you reset the count to 0 after the randomization is made? if it doesn't, how is the randomization able to be preserved for future use of it?
Ok here is how the triggers work:

-Randomize the switches and set 1 dc
-The switches land on a certain sequence
-The trigger with the matching sequence in the conditions does whatever you want it to do, then resets the dc to 0
-Randmize the switches, and set 1 dc.. and repeat the process

What the deathcount does, it is makes sure that after the switches randomize, the outcome only fires 1 time, instead of randomization the switches and then having an outcome land, and then having that outcome fire non-stop.

Also, in the trigger that randomizes the switches, you should have a condition of "Suffers exactly 0 deaths", so the trigger that randomizes the switches doesn't fire non-stop as well, since that trigger sets the dc to 1.



None.

Jul 27 2009, 5:45 am Exigence Post #8



i understand how to use the DC in that way, to enable and disable triggers. But what i need is to figure out 32 different outcomes to set to 32 different triggers. I think Falkoner was using the DC in a different way then how you're trying to explain it? If he isn't then i'm completely lost. If it's any easier for you guys, my aim is Exigence21



None.

Jul 27 2009, 5:47 am CecilSunkure Post #9



Quote from Exigence
i understand how to use the DC in that way, to enable and disable triggers. But what i need is to figure out 32 different outcomes to set to 32 different triggers. I think Falkoner was using the DC in a different way then how you're trying to explain it? If he isn't then i'm completely lost. If it's any easier for you guys, my aim is Exigence21
He was explaining a very different way. I explained the way in my tutorial. My tutorial stated at the top that need an understanding of deathcounts as a pre-requisite and I didn't realize you weren't familiar with them yet :O

[Edit]I have msn if you wanna talk on that. CecilSunkure@Hotmail.com



None.

Jul 27 2009, 5:49 am rockz Post #10

ᴄʜᴇᴇsᴇ ɪᴛ!

31 = 11111 in binary (including zero). Randomize 5 switches. Add 1 to a death counter if the first one is set, 2 if the second is set, 4, if the third is set, 8 if the fourth is set, and 16 if the fifth is set. Add them all together and you have 31. If you DON'T get any switches set, you'll have zero. If they are all set, you'll have 31. Since each switch is independent, each number is equiprobable.

Now, use deaths=0-31 in your condition



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

Jul 27 2009, 5:49 am Demented Shaman Post #11



In a nut shell, what you're basically doing in one switch randomization is randomly adding powers of 2.

For example, the powers of 2 up to the fifth power are 1, 2, 4, 8, 16, 32. Now if you add up all those numbers you get 63.

However, before we decide to add a number, we first randomize a switch. Then we only add the number if the switch is set. If the switch is clear then we skip that number and move onto the next number.

So one scenario that may end up happening is the first time we randomize the switch it's set. That means we add 1. Then for the following powers of 2 the randomized switch may always end up clear, meaning we don't add anything. Our end result is then 1.

Depending on which numbers are added you can randomly get any number from 0 to 63.

We use the switch to randomly determine whether we will add the number or not.



None.

Jul 27 2009, 6:01 am Exigence Post #12



okay, I'm starting to understand how it works now. but after we use this set of triggers to attain the number that we want generated, do we reset the DC back to 0?



None.

Jul 27 2009, 6:06 am Falkoner Post #13



Quote
okay, I'm starting to understand how it works now. but after we use this set of triggers to attain the number that we want generated, do we reset the DC back to 0?

Yes, in fact, you may just want to reset it whenever you go to randomize again, you need to have an extra condition so it doesn't constantly run, in my tutorial, the condition was "If Player 1 brings 1 Terran Civilian to Randomize", then once the randomization was done, I would move the civilian away, so my number stayed the same, and then next time he got on the beacon, the Death Count was set to 0, and it would do it all over again.



None.

Jul 27 2009, 6:09 am Demented Shaman Post #14



Quote from Exigence
okay, I'm starting to understand how it works now. but after we use this set of triggers to attain the number that we want generated, do we reset the DC back to 0?
If you want to get another random number, then yes you must set the DC back to 0.

However, you should obviously make sure whatever you wanted to do with the outcome is done before you set the DC to 0 or else you're losing the outcome.

To be safe, it's probably best if you set the DC to 0 before you start doing the randomization. So make setting the DC to 0 the first thing you do in the process because you start randomly adding numbers to it.



None.

Jul 27 2009, 6:10 am Exigence Post #15



awesome. thank you so much for all of your time! :)
im a happy mapper again. i'll probably be posting more questions in the near future haha



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[2026-4-26. : 1:58 pm]
lil-Inferno -- ya
[2026-4-25. : 11:50 pm]
JamaL -- Glad to see SEN will never die. Kudos to whoever is paying the hosting fees these days!
[2026-4-25. : 3:37 pm]
NudeRaider -- (-.-,)
[2026-4-25. : 3:35 pm]
Zoan -- ;o I thought that was a monkey emote
[2026-4-25. : 3:34 pm]
Zoan -- :mods:
[2026-4-25. : 3:34 pm]
Zoan -- :mods"
[2026-4-25. : 3:20 pm]
NudeRaider -- Vrael
Vrael shouted: moderation? on SEN? in 2026? completely localized in anoeth47's topic? at this time of year?
boy, if you're not careful I'll moderate your sorry ass too!
[2026-4-25. : 3:06 pm]
RIVE -- Yyyes. Don't you see it?
[2026-4-25. : 2:11 pm]
Vrael -- moderation? on SEN? in 2026? completely localized in anoeth47's topic? at this time of year?
[2026-4-25. : 1:39 pm]
NudeRaider -- anoeth47
anoeth47 shouted: Can I get a moderator/lord of the forum to clean up my topics - delete posts not really part of the topic.
send me the links of the posts you want deleted via pm
Please log in to shout.


Members Online: DarkenedFantasies, anoeth47, Vrael, Ojan