Compile time random implementation using C++11 with constexpr:+1: The new version is available here Compiler requirements: GCC >=4.8 MSVC >=2015 Clang >=3.3