Jane Street Interview Question

How do you select 5 random numbers that add up to 1

Interview Answers

Anonymous

Sep 17, 2016

Assuming you're given a random number generator. Generate 5 random numbers then divide each by the sum of the five numbers.

20

Anonymous

Oct 17, 2017

The answer with 16 upvotes is probably not what they're looking for. The distribution you get with this method doesn't uniformly sample the set of interest. Another method is to generate 4 random numbers, order them. This subdivides the unit interval into 5 pieces, let those be your numbers. Alternatively, you could build the number constructively by inverting the CDF.

1

Anonymous

Feb 28, 2018

Let's assume x1, x2, x3, and x4 are selected randomly over (0,1). Without losing the generality assume x1

Anonymous

Feb 28, 2018

Let's assume x1, x2, x3, and x4 are selected randomly over (0,1). Without losing the generality assume x1

Anonymous

Feb 28, 2018

Let's assume x1, x2, x3, and x4 are selected randomly over (0,1). Without losing the generality assume the order from the smallest to the largest x1, x2, x3, x4. So the numbers x1, x2-x1, x3-x2, x4-x3, 1-x4 are positive and uniformly random numbers that add up to 1.

Anonymous

Sep 15, 2017

Let X1, X2, X3, X4 be identically distributed uniform random variables over (0, 1). To make the sum equal 1 with probability 1, define the last random variable as X5 = 1 - (X1 + X2 + X3 + X4).

Anonymous

Sep 14, 2016

Tried random stuff