Prev | Next | uniform_01.hpp | Headings |
# ifndef CPPAD_UNIFORM_01_HPP
# define CPPAD_UNIFORM_01_HPP
# include <cstdlib>
namespace CppAD {
inline void uniform_01(size_t seed)
{ std::srand( (unsigned int) seed); }
template <class Vector>
void uniform_01(size_t n, Vector &x)
{ static double factor = 1. / double(RAND_MAX);
while(n--)
x[n] = std::rand() * factor;
}
}
# endif