KernelTestFramework / ktf

Kernel Test Framework
BSD 2-Clause "Simplified" License
139 stars 19 forks source link

[Feature] Random Number Generation #83

Open bjoernd opened 4 years ago

bjoernd commented 4 years ago

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.

nmanthey commented 4 years ago

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

bjoernd commented 4 years ago

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.

wipawel commented 4 years ago

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

nmanthey commented 4 years ago

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

bjoernd commented 4 years ago

RNG implemented via #101

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