I have a multithreaded program where each thread calls the function erand48() to generate a random number. Each thread has its own private random seed so the seed isn't shared. However, erand48() isn't thread-safe as said in the specification.
I have tried replacing erand48() with random() which is thread-safe, but it is much much slower and performance is my first concern. I would also specify that I do not know the number of generated values in advance, so i can't pregenerate all of the values as other blogs suggested
Would there be any alternative for erand48() as fast as it and is thread-safe? Any help would be appreciated !
Aucun commentaire:
Enregistrer un commentaire