Dennis
5cd77a6e32
User hyperlinks to refer to bugzilla issues ( #8766 )
2023-06-16 14:45:44 +03:00
RazvanN7
5b3afa5987
Fix std.random to not use this in static contexts
2023-03-15 00:17:00 +01:00
Iain Buclaw
6871f95111
std.random: Fix unittests on x32 ABI targets
2022-12-12 04:02:47 +01:00
Nick Treleaven
281f42d306
Fix missing unittests in docs ( #8603 )
...
* Fix missing staticArray unittest in docs
Found using https://github.com/dlang/dmd/pull/14527 .
* Fix missing FloatRep and DoubleRep unittests in docs
* 2 JSONValue op overloads
* std.random
* detabber
* remove
* std.digest.murmurhash
2022-10-17 05:43:13 +08:00
Walter Bright
9d8756f8b2
std.random unittest class should be static
2022-08-17 14:47:59 +00:00
Dennis Korpel
80e0fa23e8
Fix 23270 - std.random.dice is poorly documented
2022-07-25 11:11:25 +02:00
Grim Maple
553d8cb56c
Fix Issue 18631 - std.random.choice does not work with const arrays
...
`auto ref` is not needed on `Range` param
2022-07-07 15:38:21 +00:00
Iain Buclaw
7a447e7865
std.random: Fix test for version(X32) targets
2021-11-30 13:25:09 +00:00
Nathan Sashihara
ebdc9a8975
Alter AMD RDAND bug detection to reduce bias against -1 in unpredictableSeed
...
Before this PR if RDRAND was working the chance of unpredictableSeed
returning -1 was 2^^-64 instead of the expected 2^^-32. Now the chance
is 2^^-32 - 2^^-64 + 2^^-96.
2021-10-15 02:54:11 +00:00
Iain Buclaw
23c8eaa74c
std.random: Add test for Issue 8671
2021-08-25 12:24:18 +00:00
dkorpel
9ec24190b1
add explicit scope/return for pure functions
2021-07-11 13:34:25 +00:00
berni44
b2019ebab0
Narrow imports of std.math in the rest of phobos.
2021-04-21 03:00:57 +02:00
Cameron Ross
df10d1e331
Fix issue 21609 - LinearCongruentialEngine fails for m = 0
2021-02-05 02:37:24 +01:00
Bernhard Seckinger
9cb7755041
Replace approxEqual with isClose
2021-01-28 10:39:50 +01:00
Nathan Sashihara
fdf20e718a
Fix Issue 21384 - std.random.uniform!T() and std.random.uniform!T(urng) when T is dchar with any qualifiers can exceed dchar.max
2020-11-13 06:58:07 -08:00
Nathan Sashihara
f5c9556e48
Fix Issue 21383 - std.random.uniform!T(urng) when T is dchar disregards urng and always uses a thread-local random
2020-11-13 06:52:08 -08:00
Lance Bachmeier
dec85a4a57
Remove trailing whitespace
2020-08-10 10:33:54 -05:00
Lance Bachmeier
a864971c45
Update std/random.d
...
Co-authored-by: Sebastian Wilzbach <seb@wilzba.ch>
2020-08-10 10:25:45 -05:00
Lance Bachmeier
94132a52f5
Update std/random.d
...
Co-authored-by: Sebastian Wilzbach <seb@wilzba.ch>
2020-08-10 10:25:18 -05:00
Lance Bachmeier
945f9510b1
Update random.d
...
Demonstrate basic usage of uniform01. The existing example is confusing because it mixes in feqrel without any explanation, as you can see from [this question on the forum](https://forum.dlang.org/post/utjsiocsbearbenpaiut@forum.dlang.org ).
2020-08-10 10:09:39 -05:00
Andrei Alexandrescu
42138c021c
Replace Unqual-based idiom with immutable-based idiom ( #7576 )
...
Replace Unqual-based idiom with immutable-based idiom
merged-on-behalf-of: Andrei Alexandrescu <andralex@users.noreply.github.com>
2020-08-04 04:32:14 +02:00
Andrei Alexandrescu
05c79e1af1
unsignedToTempString: use the template version
2020-07-27 03:37:52 +02:00
The Dlang Bot
be16aba1cf
Merge pull request #7436 from n8sh/issue-20723
...
std.random.unpredictableSeed: on x86/x86-64 try using RDRAND when there is no arc4random
merged-on-behalf-of: Nathan Sashihara <n8sh@users.noreply.github.com>
2020-04-16 20:35:57 +02:00
Geod24
04f3979317
Replace 'Issue XXX' with Bugzilla links
...
Make the links clickable, as was done in the DMD repository.
Also avoids any ambiguity w.r.t. where the issue is stored.
2020-04-13 16:28:09 +09:00
Nathan Sashihara
f6a3678adc
Fix Issue 20723 - std.random.unpredictableSeed: on x86/x86-64 try using RDRAND when there is no arc4random
...
This code works in both DMD and LDC because LDC version 1.20.0
added support for data directives in DMD-style inline asm.
2020-04-06 21:57:13 -07:00
Jacob Carlborg
d7e574e964
Use arc4random
on iOS derived platforms
2020-03-14 15:08:54 +01:00
Adam D. Ruppe
ae93f5317c
Use consistent quickindex wrapper around hand-written list-of-links tables
2020-02-21 21:04:05 -05:00
Nathan Sashihara
67e4a08684
Issue 20548 followup: in 32-bit builds RandomCoverChoices allocates more memory than needed for the bit vector
2020-02-03 02:00:30 -08:00
Nathan Sashihara
9014d77ab0
Fix Issue 20548 - Use bit vector instead of bool[] in RandomCover when choices cannot be packed in a single word
2020-01-30 23:15:57 -08:00
Alexandru Militaru
bb62aaca3d
Replaced version (unittest) with version (StdUnittest) to avoid unnecessary overhead when compiling with -unittest
2020-01-19 14:05:17 +02:00
Bernhard Seckinger
97abb91952
Fix Issue 10902 - some phobos unittests take an excessive amount of time
2019-11-12 20:21:03 +01:00
Mike
b3416948d9
Replace sizediff_t
with ptrdiff_t
in std.random.d
2019-08-30 17:38:39 +09:00
Martin Nowak
b42d6291ab
Merge remote-tracking branch 'upstream/stable' into merge_stable
2019-06-13 01:06:21 +02:00
Nicholas Wilson
5e72cf5c1d
Merge pull request #7013 from n8sh/rndGenUnusedImports
...
Remove unused imports from std.random.rndGen
2019-05-18 13:48:34 +08:00
Nathan Sashihara
e4a38e8ea5
Remove unused imports from std.random.rndGen
2019-05-17 19:49:58 -04:00
Nathan Sashihara
8d49976514
Issue 19836 followup - also fix on 32 bit machines
...
Changed the private enhanced seeding method for `rndGen` to something
that is fast on both 64 bit and 32 bit machines so can be enabled
regardless of architecture. When compiled with LDC it is about 1.35x
the speed of public `Mt19937.seed(uint)`.
2019-05-06 05:13:56 -04:00
Nathan Sashihara
b7389926ee
Fix Issue 19837 - std.random.isUniformRNG(Rng, ElementType) should not require Rng.front to be annotated @property
2019-04-29 10:03:45 -04:00
Nathan Sashihara
5d0f1d3471
Fix Issue 19836 - Excessive probability of UUID collisions in std.uuid.randomUUID
...
On 64-bit architectures use 64 bits of entropy to initialize
thread-local `rndGen`.
The motivation for this change is std.uuid defaults to using `rndGen`
to generate UUIDs. If every `rndGen` starts in one of 2^^32 states then
if 77000 independent programs each generate a single UUID there is a 50%
chance that at least two of them generate the same initial UUID (and all
subsequent UUIDs would be identical as well). Not just Phobos but also
C++ boost::uuids::random_generator defaults to generating UUIDs with a
Mersenne Twister initialized from a 32-bit seed, exacerbating the
collision problem further. If instead there are 2^^64 possible initial
states of `rndGen` there can be over 5 billion independent `rndGen`s
before there is a 50% chance of two having identical initial states.
This change is limited to 64-bit architectures to avoid a measurable
performance decrease, because many programs are not generating UUIDs.
2019-04-28 16:16:11 -04:00
Rainer Schuetze
2e13c10025
add workaround for https://issues.dlang.org/show_bug.cgi?id=2396 to reduce compile time of unittests
2019-03-29 12:12:53 +01:00
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