This repository contains a C# implementation of MurmurHash3 modified to be more suitable for procedural generation, as well as C# code for a random numbers testing framework. The front-end part of the random numbers testing framework is based on Unity and requires Unity 4.6 or later, while the back-end and the MurmurHash3 implementations have no dependencies on Unity.
8b361a999088 — Rune Skovbo Johansen default tip 4 years ago
Rename to to conform to sourcehut's accepted format. edited online with Bitbucket edited online with Bitbucket


browse log



#Random Numbers Testing

This repository contains C# implementations of xxHash, MurmurHash3, and select other hash functions and random number generators (RNGs). These are modified and optimized to be more suitable and efficient for procedural generation.

The repository also contains C# code for a random numbers testing framework which can be used to compare the randomness quality and performance of said hash functions and RNGs.

Also see original blog post at

#Random numbers testing framework

The random numbers testing framework is divided into a front-end part which runs on top of the Unity engine (version 4.6 or later) and a back-end part which does not rely on the Unity editor or API.

The framework can be used to evaluate randomness based on these tests:

  • Visual plot of sequence of 65536 random numbers.
  • Visual plot of 50000 random coordinates.
  • Calculated Serial Correlation (test from ENT framework).
  • Calculated Monte Carlo Pi Value (test from ENT framework).
  • Calculated Diagonals Deviation (numerical measure of whether the random coordinates tend to be concentrates on certain diagonals.
  • Measured execution time (will vary dependent on machine the tests are run on).

#Random hash function implementations

xxHash and MurmurHash3 are random hash functions with very good randomness properties and good performance. The implementations in this repository has been modified to be more suitable for procedural generation:

  • Added overloads that takes an int array instead of byte array (less code and executes faster).
  • Added methods for obtaining random integers or floats in given ranges.
  • Added overloads optimized for single int input with no loop in the implementation.

The implementations are in C# and have no dependencies on Unity.


Random Numbers Testing

  • Original framework code by Rune Skovbo Johansen -
  • See files of individual hash function and RNG implementations for respective credits.

ENT (ent - pseudorandom number sequence test)


Most files in the repository are licensed under the Mozilla Public License, v. 2.0. A few files are in the public domain and thus have no restrictions on their use. See the individual files for details.

A copy of the MPL can be obtained at