David Majnemer
2dfdfdf45c
[libc++] Don't return uninitialized data from random_device::operator()
...
Make sure we appropriately retry calls to read if the return result is
less than what we asked for.
Additionally, check and handle IO errors: EINTR results in the read
operation getting restarted; other errors turn into exceptions.
llvm-svn: 210061
2014-06-03 02:40:39 +00:00
David Majnemer
1e9592a9c7
[libc++] random_device fails if open returns zero
...
random_device::random_device(const string&) wrongly assumes that open
can only validly return a file descriptor greater than zero.
This results in random_device believing that it didn't successfully open
the device causing it to throw in it's constructor, this ends up leaking
a file descriptor.
The fix is simple, don't error on file descriptors which are zero.
llvm-svn: 210060
2014-06-03 02:21:37 +00:00
Howard Hinnant
849821cffb
Fix a couple of bugs in linear_congruential_engine::seed. Regression test added.
...
llvm-svn: 182421
2013-05-21 21:05:12 +00:00
Howard Hinnant
a60ae88db2
Marshall Clow found some divide-by-zero warnings with UBSan in rand's binomial_distribution test. This eliminates the divide-by-zeros and describes in comments the numerical difficulties the test is having. Each of the problematic tests are exploring edge cases of the distribution.
...
llvm-svn: 177826
2013-03-23 19:29:45 +00:00
Marshall Clow
761b5cf087
Fix bug in test; found by AddressSanitizer
...
llvm-svn: 177464
2013-03-20 00:01:48 +00:00
Marshall Clow
1c00ce5070
Fix bug in test; found by AddressSanitizer
...
llvm-svn: 177355
2013-03-18 23:39:36 +00:00
Howard Hinnant
16694b5df5
Zhang Xiongpang: Add definitions for const data members. Fixes http://llvm.org/bugs/show_bug.cgi?id=14585 .
...
llvm-svn: 170026
2012-12-12 21:14:28 +00:00
Howard Hinnant
e386b7b360
Update <random> with constexpr support. Patch contributed by Jonathan Sauer.
...
llvm-svn: 153896
2012-04-02 21:00:45 +00:00
Howard Hinnant
e8df82fa1a
Fix test for default constructor of discrete_distribution. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=12436 .
...
llvm-svn: 153873
2012-04-02 15:00:14 +00:00
Howard Hinnant
54976f2619
Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
...
llvm-svn: 137522
2011-08-12 21:56:02 +00:00
Howard Hinnant
af6c26b366
Warning suppression in test.
...
llvm-svn: 131344
2011-05-14 15:38:08 +00:00
Howard Hinnant
3962348edf
Warning suppression in test.
...
llvm-svn: 131343
2011-05-14 15:36:25 +00:00
Howard Hinnant
a23551cad4
Fix bug in Sseq constraints found by Seth Cantrell
...
llvm-svn: 129285
2011-04-11 18:22:12 +00:00
Howard Hinnant
412dbebe1b
license change
...
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
7609c9b665
Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
...
llvm-svn: 113086
2010-09-04 23:28:19 +00:00
Howard Hinnant
a0eaf608cd
Fixing whitespace problems
...
llvm-svn: 111762
2010-08-22 00:42:21 +00:00
Howard Hinnant
03ec83e9e8
Implemented some adaptor constructors which I had missed.
...
llvm-svn: 104946
2010-05-28 15:49:54 +00:00
Howard Hinnant
b4d2fd2f0f
[rand.dist.samp.plinear]. This means we've got a fully tested and functional <random>! 489 tests over 48 sections are passing. :-) The only thing still on my plate in this area is to back-port some of this technology to random_shuffle/shuffle in <algorithm>. That will involve shuffling header bits around (<random> depepends on <algorithm>), but it won't entail that much development (compared to what has been required for <random>).
...
llvm-svn: 104575
2010-05-25 00:27:34 +00:00
Howard Hinnant
e302eab415
[rand.dist.samp.pconst] plus some bug fixes in the tests of the other distributions
...
llvm-svn: 104224
2010-05-20 15:11:46 +00:00
Howard Hinnant
fb0e5ec825
[rand.dist.samp.discrete]
...
llvm-svn: 104103
2010-05-19 01:53:57 +00:00
Howard Hinnant
ecbb921cbf
[rand.dist.norm.t]
...
llvm-svn: 104052
2010-05-18 20:08:04 +00:00
Howard Hinnant
e31e36f910
[rand.dist.norm.f]
...
llvm-svn: 104035
2010-05-18 17:32:30 +00:00
Howard Hinnant
34c3b52a2c
Better cauchy tests
...
llvm-svn: 104008
2010-05-18 00:34:49 +00:00
Howard Hinnant
6692b261d8
[rand.dist.norm.cauchy]. I'm having trouble testing the output as all statistical properties are undefined. They do not converge upon any one value as the number of samples increases. Suggestions for tests welcome.
...
llvm-svn: 103983
2010-05-17 21:55:46 +00:00
Howard Hinnant
fd5c3a34e3
[rand.dist.norm.lognormal]
...
llvm-svn: 103957
2010-05-17 18:31:53 +00:00
Howard Hinnant
c675d983f6
[rand.dist.pois.extreme]
...
llvm-svn: 103942
2010-05-17 16:21:56 +00:00
Howard Hinnant
05fa30d595
[rand.dist.bern.geo]
...
llvm-svn: 103937
2010-05-17 13:44:27 +00:00
Howard Hinnant
89eaea24bc
[rand.dist.bern.negbin]
...
llvm-svn: 103916
2010-05-17 00:09:38 +00:00
Howard Hinnant
45a999719b
Beefed up the tests for all of the distributions to include checks against the expected skewness and kurtosis
...
llvm-svn: 103910
2010-05-16 17:56:20 +00:00
Howard Hinnant
b8829825f1
[rand.dist.pois.weibull]
...
llvm-svn: 103891
2010-05-16 01:09:02 +00:00
Howard Hinnant
e3900731f6
[rand.dist.norm.chisq]
...
llvm-svn: 103888
2010-05-15 23:36:00 +00:00
Howard Hinnant
932ce81fe9
Revisited [rand.dist.bern.bin] and [rand.dist.pois.poisson] with better algorithms
...
llvm-svn: 103886
2010-05-15 21:36:23 +00:00
Howard Hinnant
0e675818f1
[rand.dist.pois.poisson]
...
llvm-svn: 103814
2010-05-14 21:38:54 +00:00
Howard Hinnant
7070922ff8
[rand.dist.pois.gamma]
...
llvm-svn: 103788
2010-05-14 18:43:10 +00:00
Howard Hinnant
f8bfb45e9b
partial [rand.dist.pois.gamma]
...
llvm-svn: 103722
2010-05-13 17:58:28 +00:00
Howard Hinnant
6f97c4e7bc
[rand.dist.norm.normal]
...
llvm-svn: 103646
2010-05-12 21:02:31 +00:00
Howard Hinnant
bcc4ff0db0
[rand.dist.pois.exp]
...
llvm-svn: 103621
2010-05-12 17:08:57 +00:00
Howard Hinnant
c1cb949c0a
tests for [rand.dist.bern.bin]
...
llvm-svn: 103612
2010-05-12 13:33:11 +00:00
Howard Hinnant
deb23ecdf9
[rand.dist.bern.bin]. The evaluation function for this binomial distribution is hopefully just a placeholder. It is using the simplest and slowest method for computing the distribution and needs to be upgraded.
...
llvm-svn: 103524
2010-05-11 23:26:59 +00:00
Howard Hinnant
5b08a8a432
Wiped out some non-ascii characters that snuck into the copyright.
...
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant
3e519524c1
libcxx initial import
...
llvm-svn: 103490
2010-05-11 19:42:16 +00:00