random (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, result_type, true_type)): Fix small thinko.
2007-10-20 Paolo Carlini <pcarlini@suse.de> * include/tr1_impl/random (uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type, result_type, true_type)): Fix small thinko. From-SVN: r129506
This commit is contained in:
parent
6f535271b7
commit
b59d6a2bba
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-10-20 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
* include/tr1_impl/random
|
||||
(uniform_int<>::_M_call(_UniformRandomNumberGenerator&, result_type,
|
||||
result_type, true_type)): Fix small thinko.
|
||||
|
||||
2007-10-19 Paolo Carlini <pcarlini@suse.de>
|
||||
|
||||
PR libstdc++/33815
|
||||
|
|
|
@ -1609,7 +1609,8 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
|
|||
// is smaller than __max - __min.
|
||||
typedef typename __gnu_cxx::__add_unsigned<typename
|
||||
_UniformRandomNumberGenerator::result_type>::__type __utype;
|
||||
return result_type((__max - __min + 1.0L) * __utype(__urng())
|
||||
return result_type((__max - __min + 1.0L)
|
||||
* (__utype(__urng()) - __utype(__urng.min()))
|
||||
/ (__utype(__urng.max())
|
||||
- __utype(__urng.min()) + 1.0L)) + __min;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue