summaryrefslogtreecommitdiff
path: root/src/common/WELL1024a.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/WELL1024a.h')
-rw-r--r--src/common/WELL1024a.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common/WELL1024a.h b/src/common/WELL1024a.h
new file mode 100644
index 0000000..04bf1a1
--- /dev/null
+++ b/src/common/WELL1024a.h
@@ -0,0 +1,32 @@
+/* ***************************************************************************** */
+/* Copyright: Francois Panneton and Pierre L'Ecuyer, University of Montreal */
+/* Makoto Matsumoto, Hiroshima University */
+/* Notice: This code can be used freely for personal, academic, */
+/* or non-commercial purposes. For commercial purposes, */
+/* please contact P. L'Ecuyer at: lecuyer@iro.UMontreal.ca */
+/* ***************************************************************************** */
+
+#define WELL1024_WIDTH 32 /* 128 bytes */
+
+typedef struct {
+ unsigned i;
+ unsigned state[WELL1024_WIDTH];
+} rngstate_t;
+
+rngstate_t* InitWELLRNG1024a (unsigned *init);
+double WELLRNG1024a (rngstate_t* s);
+
+/*!
+ * \brief Get pseudorandom number from PRNG initialized in thread-local storage.
+ *
+ * No need for initialization, TLS will take care of it.
+ *
+ * \retval Pseudorandom number.
+ */
+double tls_rand();
+
+/*!
+ * \brief Set PRNG seed in thread-local storage to requested value.
+ *
+ */
+void tls_seed_set(unsigned init[WELL1024_WIDTH]);