From c7c6d55dfb75804b119ae310e5c59ac238348665 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 15 Dec 2017 17:26:12 -0500 Subject: update version and documentation --- README.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 08afc28..d7aa3bc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -======= SyncRNG ======= A synchronized Tausworthe RNG usable in R and Python. @@ -6,15 +5,18 @@ A synchronized Tausworthe RNG usable in R and Python. Why? ==== -This program was created because it was desired to have the same random -numbers in both R and Python programs. Although both languages implement a -Mersenne-Twister RNG, the implementations are so different that it is not -possible to get the same random numbers with the same seed. +This program was created because I needed to have the same random numbers in +both R and Python. Although both languages implement a Mersenne-Twister RNG, +the implementations are so different that it is not possible to get the same +random numbers with the same seed. SyncRNG is a Tausworthe RNG implemented in ``syncrng.c``, and linked to both R and Python. Since both use the same underlying C code, the random numbers will be the same in both languages, provided the same seed is used. +You can read more about my motivations for creating this +[here](https://gertjanvandenburg.com/blog/syncrng/). + How === @@ -38,6 +40,21 @@ Similarly, after installing the R library you can do in R:: You'll notice that the random numbers are indeed the same. +R - User defined RNG +-------------------- + +R allows the user to define a custom random number generator, which is then +used for the common ``runif`` and ``rnorm`` functions in R. This has also been +implemented in SyncRNG as of version 1.3.0. To enable this, run:: + + library(SyncRNG) + + set.seed(123456, 'user', 'user') + runif(10) + +These numbers are between [0, 1) and multiplying by ``2**32 - 1`` gives the +same results as above. + Installation ============ -- cgit v1.2.3