fix doc example typo
[boost.git] / boost / nondet_random.hpp
bloba9e65fd47019311bbd28dcc4cce06c9abb3bdee5
1 /* boost nondet_random.hpp header file
3 * Copyright Jens Maurer 2000
4 * Distributed under the Boost Software License, Version 1.0. (See
5 * accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
8 * $Id$
10 * Revision history
11 * 2000-02-18 Portability fixes (thanks to Beman Dawes)
14 // See http://www.boost.org/libs/random for documentation.
17 #ifndef BOOST_NONDET_RANDOM_HPP
18 #define BOOST_NONDET_RANDOM_HPP
20 #include <string> // std::abs
21 #include <algorithm> // std::min
22 #include <boost/config/no_tr1/cmath.hpp>
23 #include <boost/config.hpp>
24 #include <boost/utility.hpp> // noncopyable
25 #include <boost/integer_traits.hpp> // compile-time integral limits
27 namespace boost {
29 // use some OS service to generate non-deterministic random numbers
30 class random_device : private noncopyable
32 public:
33 typedef unsigned int result_type;
34 BOOST_STATIC_CONSTANT(bool, has_fixed_range = true);
35 BOOST_STATIC_CONSTANT(result_type, min_value = integer_traits<result_type>::const_min);
36 BOOST_STATIC_CONSTANT(result_type, max_value = integer_traits<result_type>::const_max);
38 result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return min_value; }
39 result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return max_value; }
40 explicit random_device(const std::string& token = default_token);
41 ~random_device();
42 double entropy() const;
43 unsigned int operator()();
45 private:
46 static const char * const default_token;
49 * std:5.3.5/5 [expr.delete]: "If the object being deleted has incomplete
50 * class type at the point of deletion and the complete class has a
51 * non-trivial destructor [...], the behavior is undefined".
52 * This disallows the use of scoped_ptr<> with pimpl-like classes
53 * having a non-trivial destructor.
55 class impl;
56 impl * pimpl;
60 // TODO: put Schneier's Yarrow-160 algorithm here.
62 } // namespace boost
64 #endif /* BOOST_NONDET_RANDOM_HPP */