0

In my project I tried to use boost RNG in such manner

```
inline int rand(const int m){
uniform_smallint<> us(0,m-1);
variate_generator<rnggen_t&,uniform_smallint<> > vg(rng,us);
return vg();
}
```

where rnggen_t is type of random number generator (rng). But using this (for every generator) instead of rand()%m, is slowing my program at least 4 times (which of course is doing a lot of other things in loop). I compile this small program with -O3, and I found out that making static vector with variate_generators is slower than current implementation (and I only need random numbers for 2<=m<=6). Am I doing it wrong?

Or maybe you know any good fast random numbers generator?