summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAntonis Geralis <43617260+planetis-m@users.noreply.github.com>2020-10-29 12:14:22 +0200
committerGitHub <noreply@github.com>2020-10-29 11:14:22 +0100
commit53d9902347dad9e22171f643916e830c1b20872c (patch)
tree62e80de71c4d7cf524cf3840cc92565c4792c344 /lib/pure
parent0cae8ef2caccaf1104b21ab957dd877d5c2f461c (diff)
downloadNim-53d9902347dad9e22171f643916e830c1b20872c.tar.gz
Make default state public (#15763)
* Make default state public

* Address review comments

Co-authored-by: b3liever <b3liever@yandex.com>
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/random.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pure/random.nim b/lib/pure/random.nim
index 7c5d51ceb..3d9948d08 100644
--- a/lib/pure/random.nim
+++ b/lib/pure/random.nim
@@ -119,6 +119,12 @@ else:
     a0: 0x69B4C98CB8530805u64,
     a1: 0xFED1DD3004688D67CAu64) # global for backwards compatibility
 
+since (1, 5):
+  template randState*(): untyped =
+    ## Makes the default Rand state accessible from other modules.
+    ## Useful for module authors.
+    state
+
 proc rotl(x, k: Ui): Ui =
   result = (x shl k) or (x shr (Ui(64) - k))