SC naturally limits our random number generation with switches - they give results that are only the powers of two. This means that if you want to be more specific about your probabilities (9%, 11%, 14%, 55%, 90%, etc), you may find yourself in a bit of trouble.
To save you from this trouble, I've made a simple system that gives you a Bernoulli random variable (true or false) with the probability of being true specified by you in %.
The map. It uses up 1 switch (for random number generation) and 5 deathcounters, although it can be done in 3.
Though this is a pretty basic concept, I think it might help a few people get their heads around binary countoffs and random number generation with 1 switch. Also you can just copy/paste the triggers into your map.
The testing I managed to do so far indicates that the probability of the random variable being true is a bit less than you specify. This is probably due to me rounding up 32768 to 32700. If I'd done it to 32800, it would probably be a bit better. I can also try to increase the random variable range to, say, 2^20.
To edit the probability of success, go to P1 triggers and look into the first non-commented trigger. a can take the value between 1 and 99, obviously.
EDIT: Ran more tests. Works good for all probabilities, as it should. Rounding up 32768 to 32800 is a bad idea - really high values of a will result in constant successes, which is a big nay.
Discuss.
Some people asked about producing a random number within some range. Behold, the
! 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?