diff options
Diffstat (limited to 'src/zencore/include')
| -rw-r--r-- | src/zencore/include/zencore/testutils.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/testutils.h b/src/zencore/include/zencore/testutils.h index 45fde4eda..e2a4f8346 100644 --- a/src/zencore/include/zencore/testutils.h +++ b/src/zencore/include/zencore/testutils.h @@ -35,6 +35,21 @@ struct ScopedCurrentDirectoryChange IoBuffer CreateRandomBlob(uint64_t Size); IoBuffer CreateSemiRandomBlob(uint64_t Size); +struct FastRandom +{ + uint64_t Seed = 0x7CEBF54E45B9F5D1; + inline uint64_t Next() + { + uint64_t z = (Seed += UINT64_C(0x9E3779B97F4A7C15)); + z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9); + z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB); + return z ^ (z >> 31); + } +}; + +IoBuffer CreateRandomBlob(FastRandom& Random, uint64_t Size); +IoBuffer CreateSemiRandomBlob(FastRandom& Random, uint64_t Size); + struct FalseType { static const bool Enabled = false; |