Tag Archives: probability

Make a dice-rolling simulation in C#

This example performs a simulation of rolling two six-sided dice. It’s related to my book Interview Puzzles Dissected, which includes several examples that involve rolling dice. When you enter a number of trials and click Roll, the program uses the … Continue reading

Posted in algorithms, graphics, mathematics | Tagged , , , , , , , , , , , , | Leave a comment

Graph event probabilities in C#

The example Calculate the probability of an event occurring in a given number of trials in C# shows how to calculate event probabilities. This example graphs the results. You can use the example to get some feel for how the … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , | Leave a comment

Find the number of trials for an event probability in C#

The post Understand probabilities of unrelated events (and escaping zombies) explains how to calculate the number of trials necessary to reach a certain probability of an event occurring. It explains that if an event has a probability P of occurring … Continue reading

Posted in mathematics | Tagged , , , , , , , , | Leave a comment

Calculate the probability of an event occurring in a given number of trials in C#

The post Understand probabilities of unrelated events (and escaping zombies) explains how to calculate the probability of an event occurring in a certain number of trials. It explains that if an event has a probability P of occurring at each … Continue reading

Posted in mathematics | Tagged , , , , , , , , | 1 Comment

Understand probabilities of unrelated events (and escaping zombies)

Given some event with a relatively low probability, what is the probability that the event will occur if you perform many trials? For example, suppose the zombie apocalypse has arrived and there’s a 1% chance that the zombies will get … Continue reading

Posted in mathematics | Tagged , , , , , , , , , | 2 Comments