views:

550

answers:

5

Hi,

in my previous post I was asking how to generate numbers following a normal distribution.

Since I have also other distributions to generate and I saw 3 libraries might provide them (GSL, TechnicalReport1(doc link?), Boost), I was wondering which one you would choose.

As a side note: the reference platform for my application is a GNU/Linux system and performance is a matter.

+1  A: 

Boost is nice because it's cross platform. Honestly, though, if you just need the numbers to not be cryptographically secure, a mersenne twister will be very fast from any of those libraries. If it's a bottleneck, just do some tests to find which is fastest.

rlbond
+2  A: 

Take Boost it is quite popular and well designed for C++.

GSL is very good library that gives tools far behind distributions, but it is covered by GPL (not LGPL) meaning that if you want to develop non-GPL applications and distribute them, you can't.

Artyom
+2  A: 

Mersenne twister gives uniformly distributed numbers. There are two common approaches to generating normally distributed numbers from them:

  1. Box-Muller transform

  2. Ziggurat method

In my experience, the Ziggurat is 2x faster in Java, because it calls slow log/exp functions much less often than Box-Muller. I don't know how it is in C++.

quant_dev
+2  A: 

Here are some notes on getting started with random number generation using C++ TR1.

John D. Cook
thanks, really liked it!
puccio
A: 

I like Boost being available in both windows and linux/unix. But it's random number generator and statistical distribution design is SO convoluted. I especially hate how you have to specify the type of the random number generator in the type of your random variate. In GSL it is straightforward unfortunately doesn't seem to compile natively for windows.

Apprentice Queue