+/* This is the 32-bit PRNG recommended in G. Marsaglia, "Xorshift RNGs",
+ * _Journal of Statistical Software_ 8:14 (July 2003). According to the paper,
+ * it has a period of 2**32 - 1 and passes almost all tests of randomness.
+ *
+ * We use this PRNG instead of libc's rand() because rand() varies in quality
+ * and because its maximum value also varies between 32767 and INT_MAX, whereas
+ * we often want random numbers in the full range of uint32_t.
+ *
+ * This random number generator is intended for purposes that do not require
+ * cryptographic-quality randomness. */
+
+/* Current random state. */
+DEFINE_STATIC_PER_THREAD_DATA(uint32_t, seed, 0);
+
+static uint32_t random_next(void);
+