Live data from Hacker News

How many draws of a random number [0,1] are needed to sum to 1

bayesianthink.blogspot.com

1–10 of 42 posts

Re: How many draws of a random number [0,1] are needed to sum to 1

#2
Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

Re: How many draws of a random number [0,1] are needed to sum to 1

#5

Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

It's very easy to verify experimentally that e is likely the correct answer.

Re: How many draws of a random number [0,1] are needed to sum to 1

#6

Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

You are correct.

Re: How many draws of a random number [0,1] are needed to sum to 1

#7

Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

It's very easy to verify experimentally that e is likely the correct answer.

I confirmed it for fun. Got 2.746 over 10000 trials. Close enough.

  (average (map-n (fn ()
		    (1+ (position-if (let1 x 0
				       (fni (

Re: How many draws of a random number [0,1] are needed to sum to 1

#8

Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

It's very easy to verify experimentally that e is likely the correct answer.

Doubly confirmed. 2.71832 over 100M trials.

  import random

  totalsteps = 0
  for i in range(100000000):
  	sum = 0.0
  	steps = 0
  	while sum 

Re: How many draws of a random number [0,1] are needed to sum to 1

#9

Isn't the pdf of a uniform distribution just f(x) = 1. What he gave was an exponential distribution with rate parameter lambda. The rest of the math seems correct. But the dependence on e is not surprising as it is relevant to the initial pdf. Am I missing something?

It's very easy to verify experimentally that e is likely the correct answer.

Yep: http://codepad.org/gIaWdVY9

EDIT: Beaten to it :)

Post reply on HN