Commit graph

361 commits

Author SHA1 Message Date
Joseph Rushton Wakeling
004ce96368 Unittests for randomSample being passed an InputRange.
The assignment of _input = input has been moved from
initialize() to the constructors so as to avoid
problems with nested structs.
2013-06-04 21:54:14 +02:00
Joseph Rushton Wakeling
cbdd14b57b Issue 10265 - RandomSample fails when passed an InputRange as input
* Issue fixed by making presence of save() property conditional
   on input being a ForwardRange.
2013-06-04 19:27:58 +02:00
Walter Bright
a2c9066282 immutable should be an enum 2013-05-25 13:32:53 -07:00
Nils Boßung
4238f5b3ce add an overload for uniform!enum that takes a generator 2013-04-06 23:01:37 +02:00
Timothee Cour
a983cd6d79 Update random.d
fixed spacing
2013-03-12 18:21:47 -07:00
Timothee Cour
e3221dd626 Update random.d
fix wrong usage in doc example (Random gen(unpredictableSeed)).
2013-03-12 16:44:55 -07:00
Andrej Mitrovic
c95100ba78 Fixes Issue 9339 - Uniform for enums. 2013-01-22 02:20:43 +01:00
k-hara
01df2f60be Remove redundant parenthesis for getters, and use assignment syntax for setters 2012-11-23 15:07:17 +09:00
dsimcha
f2c17d9b0d Add std.random.partialShuffle. 2012-07-25 21:37:41 -04:00
Andrei Alexandrescu
92335506d3 Merge pull request #654 from dawgfoto/fix8314
fix issue 8314
2012-07-22 19:50:22 -07:00
jmdavis
735c2adbda Changes required for issue# 6277. 2012-07-21 01:57:28 -07:00
Martin Nowak
aa896e08cc set random generator in constructor
- Bug 8314 was already fixed by adding a _first flag
2012-07-20 16:34:49 +02:00
jmdavis
28781bfb9f Old deprecations which were not properly taken care of previously. 2012-07-07 02:03:49 -07:00
Andrei Alexandrescu
ae15e0ec14 Merge pull request #553 from WebDrake/master
Rewrite of RandomSample to use Jeffrey Scott Vitter's Algorithm D.
2012-07-01 19:14:52 -07:00
Johannes Pfau
589218003d Fix isSeedable documentation 2012-06-18 14:52:44 +02:00
Johannes Pfau
c0be641cd5 Add seed(InputRange) overload to MersenneTwisterEngine 2012-06-17 13:26:49 +02:00
Joseph Rushton Wakeling
205c3bf4cb Fix problem of first sample point always being identical. 2012-05-09 20:57:52 +02:00
Joseph Rushton Wakeling
5f539a1622 Fix link errors in Ddoc comments. 2012-05-04 20:19:44 +02:00
Joseph Rushton Wakeling
d7f5bb0aa5 Small typo correction in comment/doc. 2012-05-04 20:07:10 +02:00
Joseph Rushton Wakeling
40a79b32e2 RandomSample should check if input is InputRange. 2012-05-04 19:04:52 +02:00
Joseph Rushton Wakeling
56ef13997e Bring code in line with D style. 2012-05-04 14:22:34 +02:00
Joseph Rushton Wakeling
39bc5ae412 skip() and skipA() should not be called as properties.
Ensures code builds with -property and -unittest flags
both enabled.
2012-05-04 12:56:59 +02:00
jmdavis
76def7af85 Fix Issue# 8026.
I added template constraints to all of the templates missing template
constraints in std.random - including randomShuffle, per the bug.
2012-05-03 19:47:15 -07:00
jmdavis
088a228b34 Fixed incorrectly named enum. 2012-05-03 19:40:40 -07:00
jmdavis
1b14818170 Fixed incorrect braces in std.random. 2012-05-03 19:13:23 -07:00
jmdavis
cdd6a858b5 Remove unneeded C stuff and trailing whitespace from std.random. 2012-05-03 19:00:17 -07:00
Joseph Rushton Wakeling
34c7d2f9ec Tweaks to authorship & comments. 2012-04-26 22:27:23 +02:00
Joseph Rushton Wakeling
a47707a197 Rewrite of RandomSample to use Jeffrey Scott Vitter's Algorithm D.
This algorithm calculates a random sample of size n in O(n) time,
generating O(n) random variates, as opposed to the previously
implemented Algorithm S where both scale with the size of the
data being sampled.

Variable names in the implementation follow those in Vitter's
papers introducing the algorithm:

  * Vitter, J. S. (1984) Faster methods for random sampling.
    Commun. ACM 27(7): 703--718.

  * Vitter, J. S. (1987) An efficient algorithm for sequential
    random sampling.  ACM Trans. Math. Softw. 13(1): 58--67.
2012-04-24 17:45:12 +02:00
Andrei Alexandrescu
d2a605d8ec Merge pull request #398 from jpf91/isRNG
Add isRandomNumberGenerator template
2012-04-07 13:37:54 -07:00
James Miller
fba8c66dfa Fixes typo in randomShuffle documentation 2012-03-28 19:04:09 +13:00
Johannes Pfau
d99c33c8c7 Rename isRandomNumberGenerator to isUniformRNG 2012-02-21 19:22:35 +01:00
Johannes Pfau
58ea0229d2 Merge branch 'master' into isRNG 2012-02-21 19:10:46 +01:00
Johannes Pfau
1c07d0a2cd Reimplement isRandomNumberGenerator 2012-02-08 17:16:17 +01:00
Johannes Pfau
324b541d6f Add isRandomNumberGenerator template 2012-01-19 12:59:23 +01:00
Daniel Green
58f4356ca2 Change version( Win32 ) to version( Windows ) when Win64 would be supported as well. 2012-01-16 22:10:18 -05:00
Brad Roberts
532b26e6e0 Merge pull request #348 from CyberShadow/std-random-randomsample
std.random: Fix documentation and one of randomSample's overloads.
2011-12-18 03:39:57 -08:00
Vladimir Panteleev
e18c9d6435 std.random: Fix documentation and one of randomSample's overloads. 2011-12-05 12:04:00 +02:00
David Nadlinger
e312f9898b Strict @property syntax compliance.
This enables the test suite to build with the -property switch enabled.

std.cpuid: vendor()/processor() have not been converted to properties in accordance to core.cpuid.
std.xml: Element.text() cannot be a property due to the optional parameter.
2011-12-04 09:56:14 +01:00
Laurie Clark-Michalek
41c4d79a71 Fixed typo in documentation for dice function in std.random 2011-10-27 01:30:27 +02:00
dsimcha
e7e12c0d57 Make c'tor public again 2011-10-19 09:25:57 -04:00
dsimcha
8d1222b9ae Make c'tor private since people should use free functions. 2011-10-14 20:51:23 -04:00
dsimcha
2b04619816 Bug 6802: RandomSample should take a generator as an argument 2011-10-12 22:37:08 -04:00
Brad Roberts
4aded5d345 break std.random's dependency on std.datetime 2011-10-02 23:37:55 -07:00
Brad Roberts
a8a6337ffa move getpid from phobos std.process to druntime core.thread and use in std.random 2011-10-02 00:27:01 -07:00
k-hara
78a2d8abdc Reduce module dependencies. 2011-09-29 07:09:16 +09:00
jmdavis
7bdcb69b21 Removed deprecated std.random.rand and rand_seed.
They've been deprecated since at least 2.039.
2011-08-14 20:12:52 -07:00
KennyTM~
852aa7d723 Remove the DDoc specialization for std.random.uniform.
Since Bug 6090 has been fixed, there is no need to have a special StdDdoc version
for std.random.uniform which replaces the unmatched ')' with '$(RPAREN)', as shown
in http://d-programming-language.org/phobos/std_random.html#uniform.
2011-07-04 17:39:53 +08:00
dawg
ab43002fa0 add unittests for std.random.uniform 2011-06-20 01:32:46 +02:00
dawg
8e96ae8b77 fix shift overflow 2011-06-19 04:54:22 +02:00
Andrei Alexandrescu
c1ec579fa5 Merge pull request #86 from andralex/website
Fix 672 broken links (complements work in d-programming-language.org)
2011-06-09 09:33:13 -07:00