9

What's the easiest way to draw a random number from an exponential distribution in Python?

Jake
  • 283
  • 2
  • 8
  • 14
  • Do you have a copy of a computer science textbook that cover this? Have you looked at this: http://en.wikipedia.org/wiki/Exponential_distribution#Generating_exponential_variates? – S.Lott Mar 31 '10 at 15:01

2 Answers2

18

random.expovariate of course.

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
0

You can use the random module. For more information, consult its documentation.

serv-inc
  • 35,772
  • 9
  • 166
  • 188
Spikie
  • 389
  • 2
  • 8
  • 21