Simulate a [0,1] Uniform Random Variate
Keywords: simulate [01] uniform random variate syntax purpose seed n source code

| Prev | Next |  |  |  |  |  | uniform_01_c |

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(seed); }
    void uniform_01(unsigned n, double* a)
    {    static double factor = 1. / (double) RAND_MAX;
         while(n--)
              a[n] = rand() * factor;
    }

`

Input File: compare_c/det_by_minor.c