diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-04-04 13:01:05 -0400 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2016-04-04 13:01:05 -0400 |
| commit | c1b5e8f5e8468391f079fe4c4f40ff1fade36d96 (patch) | |
| tree | f8b7f4941461c902555b4b9ef3b748f133751e8b | |
| parent | update readme, bump version to 1.0, store first 1000 for future reference (diff) | |
| download | SyncRNG-c1b5e8f5e8468391f079fe4c4f40ff1fade36d96.tar.gz SyncRNG-c1b5e8f5e8468391f079fe4c4f40ff1fade36d96.zip | |
use deepcopy in Python in case a numpy array is used
| -rw-r--r-- | Python/SyncRNG.py | 3 | ||||
| -rw-r--r-- | README.md | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Python/SyncRNG.py b/Python/SyncRNG.py index 7ef6fd6..0ab4c06 100644 --- a/Python/SyncRNG.py +++ b/Python/SyncRNG.py @@ -6,6 +6,7 @@ used to seed and pull numbers from the RNG. from __future__ import division +from copy import deepcopy from warnings import warn as _warn import syncrng @@ -40,7 +41,7 @@ class SyncRNG(object): return int(r*maxsize) % n def shuffle(self, x): - y = x[:] + y = deepcopy(x) for i in reversed(range(1, len(y))): j = self.randbelow(i+1) y[i], y[j] = y[j], y[i] @@ -34,7 +34,7 @@ Similarly, after installing the R library you can do in R: ```R library(SyncRNG) -s = SyncRNG(seed=123456) +s <- SyncRNG(seed=123456) for (i in 1:10) { cat(s$randi(), '\n') } |
