class discard_block
{
// __glibcxx_class_requires(typename base_type::result_type,
- // ArithmeticTypeConcept);
+ // ArithmeticTypeConcept)
public:
/** The type of the underlying generator engine. */
* James's luxury-level-3 integer adaptation of Luescher's generator.
*/
typedef discard_block<
- subtract_with_carry<int, (1<<24), 10, 24>,
+ subtract_with_carry<int, (1 << 24), 10, 24>,
223,
24
> ranlux3;
* James's luxury-level-4 integer adaptation of Luescher's generator.
*/
typedef discard_block<
- subtract_with_carry<int, (1<<24), 10, 24>,
+ subtract_with_carry<int, (1 << 24), 10, 24>,
389,
24
> ranlux4;
class xor_combine
{
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::
- // result_type, ArithmeticTypeConcept);
+ // result_type, ArithmeticTypeConcept)
// __glibcxx_class_requires(typename _UniformRandomNumberGenerator2::
- // result_type, ArithmeticTypeConcept);
+ // result_type, ArithmeticTypeConcept)
public:
/** The type of the the first underlying generator engine. */
- typedef _UniformRandomNumberGenerator1 base1_type;
+ typedef _UniformRandomNumberGenerator1 base1_type;
/** The type of the the second underlying generator engine. */
- typedef _UniformRandomNumberGenerator2 base2_type;
+ typedef _UniformRandomNumberGenerator2 base2_type;
+
+ private:
+ typedef typename base1_type::result_type _Result_type1;
+ typedef typename base2_type::result_type _Result_type2;
+
+ public:
/** The type of the generated random value. */
typedef typename _Private::_Select<
- (sizeof(base1_type) > sizeof(base2_type)),
- base1_type,
- base2_type
- >::_Type result_type;
+ (sizeof(_Result_type1) > sizeof(_Result_type2)),
+ _Result_type1, _Result_type2>::_Type result_type;
// parameter values
static const int shift1 = __s1;
#else
explicit
- random_device(const std::string& __token = "rand")
+ random_device(const std::string& __token = "mt19937")
: _M_mt(_M_strtoul(__token)) { }
private:
_M_strtoul(const std::string& __str)
{
unsigned long __ret = 5489UL;
- if (__str != "rand")
+ if (__str != "mt19937")
{
const char* __nptr = __str.c_str();
char* __endptr;
--- /dev/null
+// 2006-06-15 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// 5.1.4.6 Class template xor_combine [tr.rand.eng.xor]
+// 5.1.1 Table 15 default ctor
+
+#include <tr1/random>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ using namespace std::tr1;
+ xor_combine
+ <
+ minstd_rand, 1,
+ minstd_rand0, 2
+ > x;
+
+ VERIFY( x() == 32642 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}