ktf icon indicating copy to clipboard operation
ktf copied to clipboard

[Feature] Random Number Generation

Open bjoernd opened this issue 5 years ago • 5 comments

Is your feature request related to a problem? Please describe. I want to create random numbers.

Describe the solution you'd like Add a PRNG and random/srand functions to KTF.

Additional context We may want configurable selection of PRNG or a real RNG depending on use case.

bjoernd avatar Aug 29 '20 22:08 bjoernd

Does the PRNG need to be fast, statistically robust, thread safe?

nmanthey avatar Aug 30 '20 18:08 nmanthey

It should just magically work!

We might even have multiple variants (selected at compile time?).

My use case is: I want to seed the RNG and be able to reproduce the sequence of random numbers (that's why I need a PRNG rather than real randomness). I will likely not use it concurrently.

bjoernd avatar Aug 30 '20 19:08 bjoernd

For x86 we can employ RDSEED and RDRAND instructions for the PRNG.

wipawel avatar Aug 30 '20 19:08 wipawel

I implemented a simple one, which should work for basic, test-like, work loads.

nmanthey avatar Sep 29 '20 12:09 nmanthey

RNG implemented via #101

We might still want to use hardware random number generation later.

bjoernd avatar Sep 30 '20 13:09 bjoernd