Bug 18327 – std.random.XorshiftEngine is parameterized by UIntType but only works with uint

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-01-30T00:19:02Z
Last change time
2018-11-15T15:49:33Z
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2018-01-30T00:19:02Z
The documentation says that std.random.XorshiftEngine uses a 32-bit algorithm but XorshiftEngine is parameterized by UIntType and permits non-uint UIntType but does not work correctly with them. The solution is to either make non-uint a compilation failure or to make XorshiftEngine support other UIntType.
Comment #1 by github-bugzilla — 2018-11-15T15:49:33Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/c99a1855f612ac476aa9318a17efc31a97b325b7 Fix Issue 18327 - std.random.XorshiftEngine is parameterized by UIntType but only works with uint Also: * Add ability to specify shift directions. * Allow arbitrary XorshiftEngine sizes instead of predefined list only. * Except when array is small, use index to make speed of `popFront` independent of array size. https://github.com/dlang/phobos/commit/ac2c7c627deaa137dd72bd043370a9f85d2afb62 Merge pull request #6424 from n8sh/xorshift-18327 Fix Issue 18327 - std.random.XorshiftEngine is parameterized by UIntType but only works with uint merged-on-behalf-of: Nicholas Wilson <[email protected]>