# Ticket #1122 (new enhancement)

Opened 7 years ago

## Random.repy: Negative-exponential distributed random values

Reported by: | albert | Owned by: | justinc |
---|---|---|---|

Priority: | trivial | Milestone: | |

Component: | seattlelib | Version: | 0.1t |

Severity: | Low | Keywords: | |

Cc: | justinc | Blocking: | |

Blocked By: |

### Description

Negative-exponential distributed random values are so useful that I think we could enhance `random.repy` to produce them for us:

def random_negexp(lambd): """ Generate negative-exponentially distributed random numbers with mean 1/lambd using Knuth's Logarithm Method (see TAOCP, Vol. 2, 3rd ed., p. 133 for the algorithm). Note that ``lambd'' is used because ``lambda'' is a reserved keyword in Python. """ return -math_log(randomfloat()) / lambd

**Note:**See TracTickets for help on using tickets.