From 88648a68e77fd4346333b8f8bd48917ad8114728 Mon Sep 17 00:00:00 2001 From: Pharap <2933055+Pharap@users.noreply.github.com> Date: Thu, 26 Sep 2019 09:37:16 +0100 Subject: [PATCH] Add a comment about xorshift (#62) --- Minesweeper/Utils/SkullHash.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Minesweeper/Utils/SkullHash.h b/Minesweeper/Utils/SkullHash.h index 7fdd16f..0ddcf65 100644 --- a/Minesweeper/Utils/SkullHash.h +++ b/Minesweeper/Utils/SkullHash.h @@ -20,6 +20,10 @@ struct SkullHash { + // This is actually part of the algorithm for an 'Xorshift' PRNG variant. + // PRNG algorithms that have a single-value state can be easily repurposed as hash functions. + // The shift values are taken from page 4 of George Marsaglia's 'Xorshift RNGs'. + // Marsaglia's 'Xorshift RNGs': https://www.jstatsoft.org/article/view/v008i14 static uint32_t hash(uint32_t value) { value ^= (value << 13);