1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP
12 #define BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP
16 #include <boost/compute/command_queue.hpp>
17 #include <boost/compute/random/default_random_engine.hpp>
18 #include <boost/compute/random/uniform_real_distribution.hpp>
24 template<class OutputIterator, class Generator>
25 inline void random_fill(OutputIterator first,
30 g.fill(first, last, queue);
33 template<class OutputIterator>
35 random_fill(OutputIterator first,
37 typename std::iterator_traits<OutputIterator>::value_type lo,
38 typename std::iterator_traits<OutputIterator>::value_type hi,
42 std::iterator_traits<OutputIterator>::value_type value_type;
44 boost::compute::default_random_engine engine_type;
46 boost::compute::uniform_real_distribution<value_type> distribution_type;
48 engine_type engine(queue);
49 distribution_type generator(lo, hi);
50 generator.fill(first, last, engine, queue);
53 } // end detail namespace
54 } // end compute namespace
55 } // end boost namespace
57 #endif // BOOST_COMPUTE_ALGORITHM_DETAIL_RANDOM_FILL_HPP