commit 1e2e195fdee584345c7c98ba0c99f421ca61e646 parent f8dd5dff06040e1b44b10293d31d4ba4ae31ce7d Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Jan 16 15:06:33 +0000 Add rng_p Diffstat:
rng/rng_utils.h | | | 5 | +++++ |
diff --git a/rng/rng_utils.h b/rng/rng_utils.h @@ -19,6 +19,11 @@ double rng_double( T * rng ) { return ( double ) r53 / ( ( u64 ) 1 << 53 ); } +template< typename T > +bool rng_p( T * rng, double p ) { + return rng_double( rng ) < p; +} + /* * Copyright (c) 2008, Damien Miller <djm@openbsd.org> *