summaryrefslogtreecommitdiff
path: root/src/z-rand.hpp
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
committerBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
commit6d11bb4a2d5bc8ab7c1491639f1083532b1b8fd1 (patch)
tree0a1ee125b7c5ef7ec37ff0781392989be4f75e26 /src/z-rand.hpp
parent36969a9058806e71078efcb04a91cc263612d42e (diff)
Replace RNG with PCG random number generator
Diffstat (limited to 'src/z-rand.hpp')
-rw-r--r--src/z-rand.hpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/z-rand.hpp b/src/z-rand.hpp
index cac28167..235b9503 100644
--- a/src/z-rand.hpp
+++ b/src/z-rand.hpp
@@ -1,8 +1,9 @@
#pragma once
#include "h-basic.h"
+#include "seed_fwd.hpp"
-
+#include <string>
/**** Available constants ****/
@@ -19,17 +20,34 @@
/**** Available Variables ****/
-extern bool_ Rand_quick;
-extern u32b Rand_value;
-extern u16b Rand_place;
-extern u32b Rand_state[RAND_DEG];
+/**
+ * Change to "quick" RNG, using the given seed.
+ */
+void set_quick_rng(seed_t const &seed);
+
+
+/**
+ * Change to "complex" RNG which uses the "non-deterministic" seed.
+ */
+void set_complex_rng();
+
+
+/**
+ * Get a copy of the state of the "complex" RNG.
+ */
+std::string get_complex_rng_state();
+/**
+ * Set the state of the "complex" RNG. The given array must have
+ * been previously obtained via the get_complex_rng_state() function.
+ */
+void set_complex_rng_state(std::string const &state);
+
/**** Available Functions ****/
-void Rand_state_init(u32b seed);
-s32b Rand_mod(s32b m);
+void Rand_state_init();
s16b randnor(int mean, int stand);
s32b damroll(s16b num, s16b sides);
s32b maxroll(s16b num, s16b sides);