commit d8eb933ac79d7b8064f23777f2fd8f2f2f87eb33 parent 92f344287d4a46ea5de470d9c4d01b242066a1e0 Author: Michael Savage <mikejsavage@gmail.com> Date: Sat May 20 14:57:13 +0300 Faster rng_p Diffstat:
rng/rng_utils.h | | | 4 | ++-- |
diff --git a/rng/rng_utils.h b/rng/rng_utils.h @@ -1,6 +1,6 @@ #pragma once -#include "../intrinsics.h" +#include "intrinsics.h" // TODO: this probably sucks template< typename T > @@ -20,7 +20,7 @@ double rng_double( T * rng ) { template< typename T > bool rng_p( T * rng, double p ) { - return rng_double( rng ) < p; + return rng_next( rng ) < u32( p * U32_MAX ); } /*