<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - uniform_real_distribution produces variates in its range _inclusive_ rather than exclusive."
href="http://llvm.org/bugs/show_bug.cgi?id=18767">18767</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>uniform_real_distribution produces variates in its range _inclusive_ rather than exclusive.
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>hhinnant@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>seth.cantrell@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>The following program should complete successfully.
#include <cassert>
#include <random>
#include <cmath>
int main() {
double range[] = {1.0, std::nextafter(1.0, 2.0)};
std::uniform_real_distribution<double> dist(range[0], range[1]);
std::default_random_engine eng;
for (int i=0; i<10; ++i) {
double v = dist(eng);
assert(range[0] <= v && v < range[1]);
}
}
Using libc++ it instead produces an assertion failure. Other implementations
(vc++ and libstdc++) exhibit the same behavior.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>