+ /**
+ * Returns a secure random uint32_t
+ */
+ static uint32_t secureRand32() {
+ return secureRandom<uint32_t>();
+ }
+
+ /**
+ * Returns a secure random uint32_t in [0, max). If max == 0, returns 0.
+ */
+ static uint32_t secureRand32(uint32_t max) {
+ SecureRNG<uint32_t> srng;
+ return rand32(max, srng);
+ }
+
+ /**
+ * Returns a secure random uint32_t in [min, max). If min == max, returns 0.
+ */
+ static uint32_t secureRand32(uint32_t min, uint32_t max) {
+ SecureRNG<uint32_t> srng;
+ return rand32(min, max, srng);
+ }
+
+ /**
+ * Returns a secure random uint64_t
+ */
+ static uint64_t secureRand64() {
+ return secureRandom<uint64_t>();
+ }
+
+ /**
+ * Returns a secure random uint64_t in [0, max). If max == 0, returns 0.
+ */
+ static uint64_t secureRand64(uint64_t max) {
+ SecureRNG<uint64_t> srng;
+ return rand64(max, srng);
+ }
+
+ /**
+ * Returns a secure random uint64_t in [min, max). If min == max, returns 0.
+ */
+ static uint64_t secureRand64(uint64_t min, uint64_t max) {
+ SecureRNG<uint64_t> srng;
+ return rand64(min, max, srng);
+ }
+
+ /**
+ * Returns true 1/n of the time. If n == 0, always returns false
+ */
+ static bool secureOneIn(uint32_t n) {
+ SecureRNG<uint32_t> srng;
+ return rand32(0, n, srng) == 0;
+ }
+
+ /**
+ * Returns a secure double in [0, 1)
+ */
+ static double secureRandDouble01() {
+ SecureRNG<uint64_t> srng;
+ return randDouble01(srng);
+ }
+
+ /**
+ * Returns a secure double in [min, max), if min == max, returns 0.
+ */
+ static double secureRandDouble(double min, double max) {
+ SecureRNG<uint64_t> srng;
+ return randDouble(min, max, srng);
+ }
+