We have to create random numbers between 0 and 1 in one of our projects. To create a statistical distribution between these numbers, the generator is called with each calculation cycle. The problem is that this distribution doesn't turn out very good, because the generator uses CPU ticks as a seed value and that's way too fast for our approach.
Maybe someone can point us to an alternative random number generator or another solution? Any idea is highly appreciated. Thanks a lot in advance.
Random numbers in C++
Random numbers in C++
Thomas Schlick | Next Limit Technologies
Re: Random numbers in C++
Hi Thomas,
if you only set the seed once and call many times rand(), it should return some coherent random numbers.
However, if you are calling srand(seed) and then only using rand() one or two times, chances of having ugly numbers as a result are really high.
In fact, if I recall correctly, we had some problem with random numbers when using particle ids as seed. We needed to skip the first rand() returned value because it was unusable.
if you only set the seed once and call many times rand(), it should return some coherent random numbers.
However, if you are calling srand(seed) and then only using rand() one or two times, chances of having ugly numbers as a result are really high.
In fact, if I recall correctly, we had some problem with random numbers when using particle ids as seed. We needed to skip the first rand() returned value because it was unusable.
Alex Ribao
RealFlow Team
Next Limit Technologies
RealFlow Team
Next Limit Technologies
Re: Random numbers in C++
Hi Alex,
As always, thanks a lot for your super fast reply. We'll definitely give it a try.
Best,
Thomas
As always, thanks a lot for your super fast reply. We'll definitely give it a try.
Best,
Thomas
Thomas Schlick | Next Limit Technologies