Home » U++ Library support » U++ Core » random functions proposal
Re: random functions proposal [message #35171 is a reply to message #35170] |
Wed, 18 January 2012 17:45   |
|
cbpporter wrote on Wed, 18 January 2012 15:44 | What Random needs is the ability to give it a seed. So you can produce the same sequence of numbers twice. Or is there already support for this?
|
These functions should be able to do that:void SeedRandom(dword *seed,int len){
if(!sRng) {
sRng = new(sRb) MTrand;
}
sRng->init_by_array(seed,len);
}
void SeedRandom(dword Seed){
if(!sRng) {
sRng = new(sRb) MTrand;
}
sRng->init_genrand(Seed);
}
But I didn't have the time to test it 
Honza
|
|
|
Goto Forum:
Current Time: Thu Jul 03 03:16:15 CEST 2025
Total time taken to generate the page: 0.03971 seconds
|