Nathan Sashihara
25300d32d1
Fix issue 15853 - std.random save methods must be const
...
Revival of dlang/phobos#4136
2019-02-08 16:52:20 -05:00
Nathan Sashihara
21120a4972
Fix Issue 19580 - [non-DMD] std.random seed bootstrap: don't count on reading an uninitialized variable being treated as an ordinary read
2019-01-14 02:05:04 -05:00
Walter Bright
233d7d617f
std.random: make dip1000 compliant
2019-01-10 03:33:08 -08:00
Nathan Sashihara
dc1a3d3efa
Fix Issue 18680 - std.random.LinearCongruentialEngine has opEquals but no toHash
...
The custom opEquals is unnecessary. Autogenerated struct equals is correct.
2018-11-21 15:05:48 -05:00
Nathan Sashihara
dcca23edca
Fix Issue 19164 - malloc may be considered pure when failure results in program exit (no need to reset errno)
2018-11-17 17:00:16 -05:00
The Dlang Bot
ac2c7c627d
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 <thewilsonator@users.noreply.github.com>
2018-11-15 16:49:25 +01:00
Nathan Sashihara
c75d6f712a
Fix Issue 18595 & Issue 18596: replace MindstdRand0 w/SplitMix & templatize unpredictableSeed!UIntType
2018-11-14 05:40:48 -05:00
ARaspiK
9bb605b8d1
Made unittest for rndGen
also nothrow @nogc
...
As requested by @ZombineDev
2018-11-11 08:08:01 +01:00
ARaspiK
3d54b63c5d
Make rndgen
nothrow
...
This passes all Phobos tests and would be really nice for no-exceptions situations, instead of appending `assumeWontThrow` to everything. Should be quick.
2018-11-10 21:47:25 +01:00
Nathan Sashihara
c99a1855f6
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.
2018-09-24 08:55:00 -04:00
Iain Buclaw
fd5facfe04
posix.mak: Enforce whitespace before opening parenthesis for version conditions
2018-09-22 16:57:24 +02:00
Sebastian Wilzbach
91c9973d72
Merge pull request #6657 from n8sh/std-random-14001-19156
...
Fix Issue 14001 & Issue 19156 - `@nogc` std.random.randomCover and std.random.randomShuffle
2018-08-14 13:54:44 +02:00
Martin Nowak
050464eda6
Merge remote-tracking branch 'upstream/stable' into merge_stable
...
# Conflicts:
# std/conv.d
2018-08-12 16:36:44 +02:00
Nathan Sashihara
3a212c0c72
Fix Issue 14001 - Optionally @nogc
std.random.randomCover
...
Fix Issue 19156 - `@nogc` std.random.randomShuffle
Solution is to use a private `_randomIndex` function that is guaranteed
to be called only with valid bounds.
2018-08-10 18:24:34 -04:00
Martin Kinkelin
4de15cec63
Remove superfluous core.stdc.* dependencies in std.{conv,random}
2018-08-06 21:40:38 +02:00
The Dlang Bot
c7b1cf1994
Merge pull request #6576 from BBasile/rnd-cov-nogc-buff
...
RandomCover use a `@nogc` buffer to store already chosen results
merged-on-behalf-of: Nathan Sashihara <n8sh@users.noreply.github.com>
2018-07-15 12:25:40 +02:00
Sebastian Wilzbach
84b98fc3f0
Remove invalid Markdown backticks in std.{container,path,random}.d
2018-06-19 22:04:01 +02:00
Basile Burg
a716ad69f1
address review: use memcpy and disable assignment
2018-06-14 07:03:23 +02:00
Basile Burg
d3a933b748
remove wrong ddoc and make disable default ctor
2018-06-13 14:13:34 +02:00
Basile Burg
4b3d0ed23c
address review: make the custom array pure
2018-06-13 07:24:07 +02:00
Basile Burg
047f7272cb
address review: use static OOME and remove useless null check
2018-06-13 06:28:49 +02:00
Basile Burg
76491474ef
cover postblit when heap storage is used
2018-06-12 09:42:01 +02:00
Basile Burg
acb48117d0
fine tweaks
2018-06-11 07:12:25 +02:00
Basile Burg
87a909c147
make impossible to change length and use a var to test if a bit field is used
2018-06-11 06:04:31 +02:00
Basile Burg
395e5e91c4
use a bit packed vector (w/o heap alloc) for small lengths
2018-06-10 21:32:26 +02:00
Basile Burg
a8869e2666
RandomCover use a @nogc
buffer to store already chosen results
2018-06-10 15:26:09 +02:00
Sebastian Wilzbach
c324714fde
Remove a few cases of underscore escaping
2018-06-04 13:05:01 +02:00
Basile Burg
cac1be5408
Annotates std.random unittests with @nogc when already possible
2018-04-21 22:01:19 +02:00
Jack Stouffer
e14f89e170
Make references to input ranges a link to isInputRange
2018-04-08 16:19:57 -04:00
The Dlang Bot
c1fcea4fdf
Merge pull request #6414 from n8sh/remove-unpredictableseed-from-unittests
...
Issue 18715 - Non-documented unittests should not use unpredictableSeed or default Random alias
merged-on-behalf-of: Nathan Sashihara <n8sh@users.noreply.github.com>
2018-04-05 01:41:30 +02:00
Nathan Sashihara
c1d1c0e874
Issue 18715 - Non-documented unittests should not use unpredictableSeed or default Random alias
2018-04-04 18:08:00 -04:00
Sebastian Wilzbach
152647e985
Add public examples to std.random
2018-04-04 11:42:56 +02:00
Sebastian Wilzbach
42894784dd
Markdownify Phobos
...
$(D word) -> `word`
2018-04-02 22:32:47 +02:00
Sebastian Wilzbach
72bfff5a74
std.random: add a module-level booktable
2018-03-31 04:33:02 +02:00
Nathan Sashihara
e9f56ba3b2
Fix Issue 18663 - std.random.isSeedable has false positives
2018-03-26 11:45:40 -04:00
The Dlang Bot
4b166f3088
Merge pull request #6331 from jmdavis/revert
...
Revert fix for 18631.
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
2018-03-23 15:51:52 +01:00
The Dlang Bot
cc256d8dc9
Merge pull request #5746 from n8sh/xorshift-fix
...
Fix Issue 17862 - std.random.XorshiftEngine.min is wrong when bits == 32
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2018-03-23 01:28:46 +01:00
Jonathan M Davis
5d6d784c9a
Revert fix for 18631.
...
The fix for 18631 broke code. Ranges cannot be marked with const or
inout in generic code. The range API does not require that any functions
be const or inout. In this case, with the changes, choice requires that
length and opSlice be const, breaking any code that uses a range with
choice that does not have a const length or opSlice (which is going to
be a large percentage of ranges with those functions which aren't
arrays).
2018-03-22 18:23:30 -06:00
The Dlang Bot
b87d28f2c7
Merge pull request #6267 from n8sh/unpredictableSeedOf-arc4random
...
Partially Fix Issue 18596: use arc4random when available for unpredictableSeed
merged-on-behalf-of: unknown
2018-03-22 23:49:27 +01:00
Nathan Sashihara
f39686c771
Partially Fix Issue 18596: use arc4random when available for unpredictableSeed
2018-03-22 03:57:47 -04:00
Basile Burg
8f2ae51cb8
proper usage of inout
2018-03-19 21:25:07 +01:00
Basile Burg
403141166b
fix issue 18631 - Allow choice to work with const arrays
2018-03-19 21:02:02 +01:00
The Dlang Bot
d9c94cbb61
Merge pull request #6211 from BBasile/issue-18501
...
fix issue 18501 - randomShuffle and partialShuffle should return their input argument
merged-on-behalf-of: Jack Stouffer <jack@jackstouffer.com>
2018-03-02 20:48:36 +01:00
Basile Burg
b9196a976c
fix issue 18501 - randomShuffle and partialShuffle should return their input argument
2018-02-23 04:38:58 +01:00
Jack Stouffer
663b5b9278
Revert addition of StdUnittest
2018-02-20 13:32:32 -05:00
Jack Stouffer
18cbb29b04
Replaced version(unittest) blocks with version(StdUnittest)
2018-02-01 19:56:59 -05:00
n8sh
fa92151982
Fix Issue 17862 - std.random.XorshiftEngine.min is wrong when bits == 32
...
XorshiftEngine.min is defined as 0 regardless of template parameters
but an XorshiftEngine cannot produce a value of zero if its internal
state has the same number of bits as the output element type.
2018-01-29 18:40:24 -05:00
Duncan Paterson
db5c1c84b9
Addresses Issue 17832
...
Random choice default argument was deciding the type of the
template. I'm not sure if this is a deeper bug, but it can easily be
fixed with this patch which simply overloads the function.
Also added a unittest which would have failed under the old code.
2018-01-28 02:00:54 +01:00
Nathan Sashihara
befc9896d0
Fix Issue 18217: Don't repeatedly call unpredictableSeed to initialize rndGen
...
Explanation: https://github.com/dlang/phobos/pull/5788#discussion_r146110307
2018-01-09 15:08:11 -05:00
Sebastian Wilzbach
7de3787876
Use static foreach in Phobos
2018-01-03 17:30:11 +01:00