Commit f28e0f45 by Paolo Carlini Committed by Paolo Carlini

random.tcc (mersenne_twister<>::operator()()): Reload the last position of the _M_x vector too.

2006-06-15  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/random.tcc (mersenne_twister<>::operator()()):
	Reload the last position of the _M_x vector too.

From-SVN: r114695
parent 92a36a4a
2006-06-15 Paolo Carlini <pcarlini@suse.de> 2006-06-15 Paolo Carlini <pcarlini@suse.de>
* include/tr1/random.tcc (mersenne_twister<>::operator()()):
Reload the last position of the _M_x vector too.
2006-06-15 Paolo Carlini <pcarlini@suse.de>
* include/tr1/random (class xor_combine): Fix result_type typedef. * include/tr1/random (class xor_combine): Fix result_type typedef.
* testsuite/tr1/5_numerical_facilities/random/xor_combine/ * testsuite/tr1/5_numerical_facilities/random/xor_combine/
cons/default.cc: New. cons/default.cc: New.
......
...@@ -298,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) ...@@ -298,7 +298,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
for (int __k = 0; __k < (__n - __m); ++__k) for (int __k = 0; __k < (__n - __m); ++__k)
{ {
_UIntType __y = ((_M_x[__k] & __upper_mask) _UIntType __y = ((_M_x[__k] & __upper_mask)
|(_M_x[__k + 1] & __lower_mask)); | (_M_x[__k + 1] & __lower_mask));
_M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1) _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)
^ ((__y & 0x01) ? __a : 0)); ^ ((__y & 0x01) ? __a : 0));
} }
...@@ -311,6 +311,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) ...@@ -311,6 +311,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
^ ((__y & 0x01) ? __a : 0)); ^ ((__y & 0x01) ? __a : 0));
} }
_UIntType __y = ((_M_x[__n - 1] & __upper_mask)
| (_M_x[0] & __lower_mask));
_M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)
^ ((__y & 0x01) ? __a : 0));
_M_p = 0; _M_p = 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment