# Questions tagged [probability-theory]

Challenges which involve computing probabilities for random variables and stochastic processes.

13 questions
Filter by
Sorted by
Tagged with
12k views

### What an Odd Function

Your task here will be to implement a function1 that forms a permutation on the positive integers (A bijection from the positive integers onto themselves). This means that each positive integer ...
• 98.8k
3k views

### 1/N probability

Because there are not enough simple code-golf challenges: Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with ...
• 30.4k
975 views

### Calculate probability of getting half as many heads as coin tosses.

Write a program that, given a small positive even integer from standard input, calculates the probability that flipping that many coins will result in half as many heads. For example, given 2 coins ...
• 693
1k views

### Calculate a probability exactly and quickly

[This is a partner question to Calculate a probability exactly ] This task is about writing code to compute a probability exactly and quickly. The output should be a precise probability written as a ...
3k views

### Not Your Routine Bean Machine

Consider this ASCII version of a mechanism similar to a bean machine or plinko/pachinko game: O ^ \ ^ ^ ^ \ \ ^ / ^ U U U U U 1 2 3 4 5 The ...
• 89.8k
2k views

### Extreme Whitewater Canoeing

You are paddling a canoe down a fairly fast whitewater river. Suddenly, your paddles explode, and you find yourself in a dangerous situation hurtling down a river rapid without any paddles. Luckily, ...
• 8,619
8k views

### Pick a random number between 0 and n using a constant source of randomness

Task Given a positive integer n less than 2^30 specified as input in any way you choose, your code should output a random ...
686 views

### A lean, mean bean machine

A classic example to introduce people to the concept of a discrete probability distribution is the bean machine. This machine has a large amount of marbles fall from a narrow passageway at the top, ...
2k views

### Frequency Distribution of Mixed Dice Rolls

A follow-up to this challenge Given a set of mixed dice, output the frequency distribution of rolling all of them and summing the rolled numbers on each die. For example, consider ...
2k views

### Frequency Distribution of Multiple Dice Rolls

Given two positive integers a and b, output the frequency distribution of rolling a b-sided ...
939 views

### Probabilities - how high can you go?

I previously asked a question for how to compute a probability quickly and accurately. However, evidently it was too easy as a closed form solution was given! Here is a more difficult version. This ...
1k views

### Calculate a probability exactly

This task is about writing code to compute a probability exactly. The output should be a precise probability written as a fraction in its most reduced form. That is it should never output ...
468 views

### A Suitable Mission

Summer Klerance, a senior in college, is what her teachers refer to as GBL*. Students in her probability class have been assigned individual problems to work on and turn in as part of their final ...
• 636