diff options
| -rw-r--r-- | README.rst (renamed from README.md) | 57 |
1 files changed, 22 insertions, 35 deletions
@@ -1,10 +1,10 @@ +======= SyncRNG ======= 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 @@ -16,56 +16,42 @@ 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. How ---- +=== First install the packages as stated under Installation. Then, in Python you -can do: +can do:: -```python -from SyncRNG import SyncRNG + from SyncRNG import SyncRNG -s = SyncRNG(seed=123456) -for i in range(10): - print(s.randi()) -``` + s = SyncRNG(seed=123456) + for i in range(10): + print(s.randi()) -Similarly, after installing the R library you can do in R: +Similarly, after installing the R library you can do in R:: -```R -library(SyncRNG) + library(SyncRNG) -s <- SyncRNG(seed=123456) -for (i in 1:10) { - cat(s$randi(), '\n') -} -``` + s <- SyncRNG(seed=123456) + for (i in 1:10) { + cat(s$randi(), '\n') + } You'll notice that the random numbers are indeed the same. Installation ------------- +============ -Installing the R package can be done through devtools: +Installing the R package can be done through CRAN:: -```R -library(devtools) -devtools::install_github("GjjvdBurg/SyncRNG") -``` + install.packages('SyncRNG') -To install SyncRNG as a Python module, first clone the repository. The Python -module can then be installed locally for the user using: +The Python package can be installed using pip:: -```sh -python setup.py install --user -``` -or system-wide through: + pip install syncrng -```sh -sudo python setup.py install -``` Usage ------ +===== In both R and Python the following methods are available for the `SyncRNG` class: @@ -77,7 +63,8 @@ class: 4. `shuffle(x)`: generate a permutation of a given list of numbers `x`. Notes ------ +===== The random numbers are uniformly distributed on `[0, 2^32 - 1]`. + |
