Tag Archives: statistics

Simulate a doubling betting strategy in C#

Casinos love customers who have a betting strategy because those customers always end up losing. As long as the game’s events are independent of each other (for example, one roll of the dice does not depend on the previous rolls), … Continue reading

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

New Book: The Modern C# Challenge

My latest book, The Modern C# Challenge, is now available. It’s a collection of 100 programming challenges that let you test your ability in a wide variety of programming topics, many of which are not usually covered in traditional programming … Continue reading

Posted in algorithms, books, files, mathematics, puzzles | Tagged , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Find two sets where the median of one is the mean of the other and vice versa in C#

For an upcoming book, I wanted to find sets where the mean (average) of one is the median (middle value) of the other and vice versa. I wanted to avoid trivial examples such as {1, 1, 1} and where the … Continue reading

Posted in algorithms, combinatorics | Tagged , , , , , , , , , , | Comments Off on Find two sets where the median of one is the mean of the other and vice versa in C#

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 , , , , , , , , , , , , | Comments Off on Make a dice-rolling simulation in C#

Plot data with standard deviation ranges in C#

The examples Draw a normal distribution curve in C# and Draw a scaled normal distribution in C# show one approach for visualizing how data is distributed. This example shows a method that lets you visualize where a particular data value … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , | Comments Off on Plot data with standard deviation ranges in C#

Draw a scaled normal distribution in C#

The example Draw a normal distribution curve in C# shows how to draw a normal distribution. Unfortunately for some means and standard deviations, the result may not be very useful. For example, Figure 1 shows a normal distribution where the … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , | Comments Off on Draw a scaled normal distribution in C#

Draw a normal distribution curve in C#

A normal distribution is a probability distribution that occurs arise when you analyze seemingly “random” occurrences. You can define a normal distribution in terms of its mean and standard deviation. Mean (μ) This is the basically the average of the … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , | 7 Comments