2
0
mirror of https://github.com/boostorg/random.git synced 2026-02-26 17:02:15 +00:00

Merge random from the trunk

[SVN r74867]
This commit is contained in:
Steven Watanabe
2011-10-09 23:13:31 +00:00
parent 2575617250
commit 658ce378a3
41 changed files with 116 additions and 63 deletions

View File

@@ -124,7 +124,7 @@ public:
RealType p() const { return _p; }
/** Returns the smallest value that the distribution can produce. */
IntType min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return IntType(1); }
IntType min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return IntType(0); }
/** Returns the largest value that the distribution can produce. */
IntType max BOOST_PREVENT_MACRO_SUBSTITUTION () const

View File

@@ -159,7 +159,7 @@ public:
// fix up the state if it's all zeroes.
if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) {
for(std::size_t j = 1; i < n; ++j) {
for(std::size_t j = 1; j < n; ++j) {
if(x[j] != 0) return;
}
x[0] = static_cast<UIntType>(1) << (w-1);
@@ -175,7 +175,7 @@ public:
// fix up the state if it's all zeroes.
if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) {
for(std::size_t j = 1; i < n; ++j) {
for(std::size_t j = 1; j < n; ++j) {
if(x[j] != 0) return;
}
x[0] = static_cast<UIntType>(1) << (w-1);

View File

@@ -98,8 +98,8 @@ public:
r3 = r3 ^ (r3 >> 27);
r3 = (r3 * 1566083941u) & mask;
value_type r4 = r3 - k%m;
*(first + (k+p)%n) ^= r4;
*(first + (k+q)%n) ^= r3;
*(first + (k+p)%n) ^= r3;
*(first + (k+q)%n) ^= r4;
*(first + k%n) = r4;
}
}