mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Make default state public (#15763)
* Make default state public * Address review comments Co-authored-by: b3liever <b3liever@yandex.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
- `prelude` now works with the JavaScript target.
|
||||
|
||||
- Added `ioutils` module containing `duplicate` and `duplicateTo` to duplicate `FileHandle` using C function `dup` and `dup2`.
|
||||
|
||||
- Added `randState` template that exposes the default random number generator. Useful for library authors.
|
||||
|
||||
## Language changes
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user