Prev Next Index-> contents reference index search external Up-> CppAD Appendix compare_c uniform_01_c CppAD-> Install Introduction AD ADFun preprocessor multi_thread utility ipopt_solve Example speed Appendix Appendix-> Faq directory Theory glossary Bib wish_list whats_new deprecated compare_c numeric_ad addon License compare_c-> det_of_minor_c det_by_minor_c uniform_01_c correct_det_by_minor_c repeat_det_by_minor_c elapsed_seconds_c time_det_by_minor_c main_compare_c uniform_01_c Headings-> Syntax Purpose seed n a Source Code

$\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}} }$
Simulate a [0,1] Uniform Random Variate

Syntax
random_seed(seed)  uniform_01(n, a)

Purpose
This routine is used to create random values for speed testing purposes.

seed
The argument seed has prototype       size_t seed  It specifies a seed for the uniform random number generator.

n
The argument n has prototype       size_t n  It specifies the number of elements in the random vector a .

a
The argument a has prototype       double* a  . The input value of the elements of a does not matter. Upon return, the elements of a are set to values randomly sampled over the interval [0,1].

Source Code
void random_seed(size_t seed)
{     srand( (unsigned int) seed );
}
void uniform_01(size_t n, double* a)
{     static double factor = 1. / (double) RAND_MAX;
while(n--)
a[n] = rand() * factor;
}

Input File: test_more/compare_c/det_by_minor.c