summaryrefslogblamecommitdiffstats
path: root/src/FastRandom.cpp
blob: 0ba5fb64a05e016ea5f63d6df63b7f53875f989c (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                 

                    

                       


 
 
                            
 





                                                   





 
                              
 





                                                                   
                             
 

// FastRandom.cpp


#include "Globals.h"
#include "FastRandom.h"





MTRand & GetRandomProvider()
{
	thread_local MTRand Random = []
		{
			cRandomDeviceSeeder Seeder;
			return MTRand(Seeder);
		}();
	return Random;
}





UInt32 Detail::GetRandomSeed()
{
	thread_local UInt32 SeedCounter = []
		{
			std::random_device rd;
			std::uniform_int_distribution<UInt32> dist;
			return dist(rd);
		}();
	return ++SeedCounter;
}