Commit graph

301 commits

Author SHA1 Message Date
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
Jack Stouffer
f28bf2d194 Add example to uniform on how to create an array of random numbers 2017-12-29 16:40:09 -05:00
Sebastian Wilzbach
df6365092a Replace body keyword with its replacement: do
Automatic replacement with

    sed -i "s/^\([ ]*\)body/\1do/" -i **/*.d
2017-11-20 15:33:52 +01:00
Martin Nowak
8e17e48db5 Merge remote-tracking branch 'upstream/stable' into merge_stable 2017-10-09 17:14:53 +02:00
Martin
8bd0e26c76 std.random: No equality checks for doc example unittests
They depend on the `Random` alias as well as the `real` precision.
2017-10-08 01:33:46 +02:00
n8sh
fd2e5ba03c Fix Issue 17847 - Properly sanitize seeds for Park–Miller engines
As in XorshiftEngine, sanitizing the seed is more useful than throwing
an exception. The original check was broken because it checked the seed
before taking the modulus. Making this change allows unpredictableSeed
to be marked nothrow and @nogc.
2017-09-21 18:55:42 -04:00
Sebastian Wilzbach
10d05229ae Make Phobos module examples runnable 2017-07-02 00:22:13 +02:00
The Dlang Bot
857fdc1312 Merge pull request #5486 from wilzbach/fix-ddoc
Fix invalid undefined Ddoc macros
merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>
2017-06-15 17:39:23 +02:00
Sebastian Wilzbach
e7111d4fd0 Fix invalid undefined Ddoc macros 2017-06-15 11:00:47 +02:00
Vladimir Panteleev
d0b9555a06
Revert "Sort selective imports"
This reverts commit 998ad51fd7.
2017-06-13 17:51:52 +00:00
Sebastian Wilzbach
998ad51fd7 Sort selective imports 2017-06-12 08:12:09 +02:00
Sebastian Wilzbach
61717ecc7d Sort imports 2017-06-12 07:54:38 +02:00
Ilya Yaroshenko
67e3438c47 Update random.d 2017-04-14 10:16:05 +07:00
Ilya Yaroshenko
91f0544227 fix link
The link is broken because the module name. Hope this will fix it.
2017-04-14 09:18:21 +07:00
H. S. Teoh
ba8ad89b45 Add disclaimer to std.random about unsuitability for cryptographical purposes. 2017-03-27 10:31:21 -07:00
Sebastian Wilzbach
d548e8830a Replace LUCKY links with actual links 2017-02-28 23:46:54 +01:00
Jack Stouffer
4ce5d44dbb Use underscores for number literals with five or more digits 2017-02-23 09:45:49 -05:00
Sebastian Wilzbach
d905ef53b1 Automatically add spaces to binary operators (<=)
command:

sed -E "s/([[:alnum:]]) <= ([[:alnum:]])/\1 <= \2/g" -i **/*.d
sed -E "s/([[:alnum:]])<= ([[:alnum:]])/\1 <= \2/g" -i **/*.d
sed -E "s/([[:alnum:]]) <=([[:alnum:]])/\1 <= \2/g" -i **/*.d
2017-02-23 00:57:47 +01:00
Sebastian Wilzbach
a2c6398332 Automatically add spaces to binary operators (==)
command:

sed -E "s/([[:alnum:]]) == ([[:alnum:]])/\1 == \2/g" -i **/*.d
sed -E "s/([[:alnum:]])== ([[:alnum:]])/\1 == \2/g" -i **/*.d
sed -E "s/([[:alnum:]]) ==([[:alnum:]])/\1 == \2/g" -i **/*.d
2017-02-23 00:57:47 +01:00