This is an initial attempt at creating a truly random number generator DLL that does not need privileged access on a device. Currently it is using ping replies for seed generation, I'll add in others as they occur to me. Internal namespace is GenericTools, class is Toolkit, subject to change as this develops.
Source code is in the EntropyTest2 folder in case you would prefer to directly include it in code instead of calling the DLL. There are currently 4 ways to initialize an instance of the class In order from fastest to slowest to initialize
-
Toolkit example = new Toolkit() OR new Toolkit(0); simply uses the native c# cryptographic number generator, is basically a wrapper for the crypto library
-
Toolkit example = new Toolkit(1) uses the internal Seed generator to establish initial values for a linear distribution psuedorandom number generator
-
Toolkit example = new Toolkit(2) uses the internal Seed generator to establish initial values for an exponential distribution psuedorandom number generator, I'm not yet satisfied with the performance of this one
-
Toolkit example = new Toolkit(3) Creates a background thread that continously maintains a queue of approximately 300 numbers produced by concurrent runs of the internal seed generator. Calls for a random number pop the frontmost number off the queue for use. Be sure to call example.StopGenerating() when you have finished using the instance, this toggles a flag value to tell the background threads to gracefully conclude.
Available Functions: example.ReallyRandom() returns a double value generated by the random number generator that was chosen at initialization
example.Eventgenerator(double VALUE) uses a value from the random number generator and will return true VALUE percent of the time, otherwise returns false
example.StopGenerating() flags the background processes used by mode 4 to conclude their current iteration and return. Use this when you no longer need the instance to create new values or just before the program concludes to allow the background threads to conclude gracefully.
Test program used to calculate distribution is in fork 'TestCradle'
Current improvements needs are way to accelerate seed generation and refine the Exponential distribution mode.
Critique and ideas are very much welcome.