Prev Next uniform_01.hpp Headings

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@ This is cppad-20221105 documentation. Here is a link to its current documentation .
Source: uniform_01
# 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

Input File: omh/uniform_01_hpp.omh