Pseudorandom Number Generator - Exponential Distri

2019-01-03 08:46发布

I would like to generate some pseudorandom numbers and up until now I've been very content with the .Net library's Random.Next(int min, int max) function. PRNGs of this variety are supposed to be using a Uniform distribution, but I would very much like to generate some numbers using an Exponential Distribution.

I'm programming in C#, although I'll accept pseudocode or C++, Java or the like.

Any suggestions / code snippets / algorithms / thoughts?

7条回答
仙女界的扛把子
2楼-- · 2019-01-03 09:12

If I understand your problem, and you can accept a finite number of PRNG's, you could follow an approach like:

  • Create an array where every element is in your exponential distribution
  • Generate a PRNG which is an integer index into the array. Return the element in the array at that index.
查看更多
登录 后发表回答