random_seed: Rewrite the generic clock() based seed code
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 11 Jun 2012 09:47:59 +0000 (11:47 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 6 Jan 2014 16:53:58 +0000 (18:53 +0200)
commit01d245ef4392152dbdc78a6ba4dfa0a6e8b08e6f
tree9e6b7bf0a2f303f6de689e380b98a9319c917201
parente61b8fa5605b16a02a2a0ea75afbfc31d7832bba
random_seed: Rewrite the generic clock() based seed code

The new code is faster and reuses the previous state in case of
multiple calls.

The previous code could easily end up in near-infinite loops,
if the difference between two clock() calls never was larger than
1.

This makes fate-parseutils finish in finite time when run in wine,
if CryptGenRandom isn't available (which e.g. isn't available if
targeting Windows RT/metro).

Patch originally by Michael Niedermayer but with some modifications
by Martin Storsjö.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavutil/random_seed.c