# Questions tagged [probability-theory]

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

66 questions
Filter by
Sorted by
Tagged with
477 views

### Pick a random string at a fixed edit distance

I have string $s$ of length $n$ and some constant integer $k$ which is at most $n$. Give the fastest algorithm to sample a random string with Levenshtein distance $k$ from $s$ uniformly. ...
1k views

### Weighted coin flip strings

Given n, k, and p, find the probability that a weighted coin with probability p of heads will flip heads at least k times in a row in n flips, correct to 3 decimal digits after decimal point (changed ...
2k views

### Sample integers that sum to one hundred

Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted). Your random sample ... 185 views

### Calculate the probability of getting this hand in n tries [closed]

Imagine there is a card game where the primary objective of the game is to get 4 of one card in your hand. Game mechanics Each player starts of with 10 cards in their hand. The remaining 32 cards (...
734 views

### Yet another coin flipping problem

Problem Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers $x_1, x_2, x_3... x_n$ representing n rounds of coin flipping. At each round, we ...
198 views

### A Suitable Mission — The Professor's Revenge

Summer Klerance turned in her term assignment for this challenge. Her professor was miffed (but also amused) when he overheard a disgruntled classmate of Summer's saying she got her answers by ...
465 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 ...
1k views

### Odds that a string of N digits contains two or more of the same

I have to fill in 2fa codes all day. They're 6-digit strings. One day I noticed that not once did any of these codes contain 6 unique digits, like 198532 There was always at least one double, like ...
2k views

### Calculate the probability of getting to the target first (exactly)

Consider the following probability puzzle. We start with a string of bits all set to 0. At each step we choose a bit uniformly and independently at random and flip it. The value your code has to ... 2k views

### Lucky dice rolls

Lucky dice rolls In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is $n\textbf{d}k$ where $n$ is the number of dice and $k$ is ...
1k views

### Penney-Conway odds

Background Penney's game is a two-player game about coin tossing. Player A announces a sequence of heads and tails of length $n$, then player B selects a different sequence of same length. The ...
260 views

### Estimate the mean minimum Hamming distance

Task Inputs $b \leq 100$ and $n \geq 2$. Consider $n$ binary strings, each of length $b$ sampled uniformly and independently. We would like to compute the expected minimum Hamming distance ... 2k views

197 views

### Talent rolls in DSA

Some friends and I have played some DSA (a mainly german tabletop RPG much like D&D). I was wondering what the chance on passing rolls are, so you will have to write some code to calculate it. ...
300 views

### Card pair probability

Given a deck consisting of N copies of cards with integer values [1,M] for a total of N*M cards, compute the probability that a card with the value of 1 is adjacent to a card with the value of 2. ...
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 ...
340 views

### Guess the hidden communities

Background This challenge is about the stochastic block model. Basically, you are given an undirected graph, where the nodes represent people, and the edges represent social connections between them. ...
583 views

### Who's that probability distribution?

Introduction In this challenge, you are given a list of nonnegative floating point numbers drawn independently from some probability distribution. Your task is to infer that distribution from the ...
2k views

### "i" have "i" chance of occuring

Design a random number generator where the i th number has i% chance of occurring for all 0 < i < 14. 0 should have exactly 9% chance of occurring. The seed for the generator should be the ...
355 views

### Implement an API for probability distributions

Introduction In this challenge, your task is to implement a collection of simple functions that together form a usable mini-library for simple probability distributions. To accommodate some of the ...
290 views

### Probability to clear the board or win

In the game Hearthstone there is a playing board containing friendly and enemy minions, and two heroes - yours and the enemy's. To generalize and simplify, we will assume it's your turn, the opponent ...
320 views

### Simple single-player board game, expected score distribution

This is the first problem I've posted here; please post criticisms in comments. Summary A game board consists of a starting space, an ending space, and between them are ... 