• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* boost random_test.cpp various tests
2  *
3  * Copyright (c) 2010 Steven Watanabe
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/LICENCE_1_0.txt)
7  *
8  * $Id$
9  */
10 
11 #include <boost/random/random_device.hpp>
12 
13 #include <boost/test/test_tools.hpp>
14 #include <boost/test/included/test_exec_monitor.hpp>
15 
test_main(int,char **)16 int test_main(int, char**) {
17     boost::random_device rng;
18     double entropy = rng.entropy();
19     BOOST_CHECK_GE(entropy, 0);
20     for(int i = 0; i < 100; ++i) {
21         boost::random_device::result_type val = rng();
22         BOOST_CHECK_GE(val, (rng.min)());
23         BOOST_CHECK_LE(val, (rng.max)());
24     }
25 
26     boost::uint32_t a[10];
27     rng.generate(a, a + 10);
28     return 0;
29 }
30