Skip to content

Implement LFRS113 PRNG functions

Remco Rijnders requested to merge remco/random into master
  • Instead of relying on random() implementations which can be of questionable quality or relying on the presence of /dev/urandom, we implement our own PRNG implementation that uses the LFRS113 PRNG algorithm by Pierre L'Ecuyer.

We seed this PRNG with values based on time, pid and ppid. It is OK if not all seeds are of the highest quality as all four seeds would have to be known to predict the numbers generated. In addition to this, we also use /dev/urandom values (if available) that we mix into our four seeds.

In case we are reseeding we will also reuse our existing state information for setting the new seed values.

  • Add a function to Base64 encode 96 random bits

Merge request reports