Loading...
Searching...
No Matches
rand1.c
Go to the documentation of this file.
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/gmath.h>
/*!
* \fn float G_math_rand (int seed)
*
* \brief Random Number Generator (Uniform)
*
* Random number generator (Uniform Derivatives 0.0 -> 1.0)
*
* \param[in] seed
* \return float
*/
float G_math_rand(void)
{
return G_drand48();
}
/*!
* \brief Seed the pseudo-random number generator
*
* \param[in] seed 32-bit integer used to seed the PRNG
*/
void G_math_srand(int seed)
{
G_srand48(seed);
}
/*!
* \brief Seed the pseudo-random number generator from the time and PID
*
* \return generated seed value passed to G_srand48()
*/
int G_math_srand_auto(void)
{
return (int)G_srand48_auto();
}
G_srand48_auto
long G_srand48_auto(void)
Seed the pseudo-random number generator from the time and PID.
Definition lrand48.c:70
G_srand48
void G_srand48(long seedval)
Seed the pseudo-random number generator.
Definition lrand48.c:52
G_drand48
double G_drand48(void)
Generate a floating-point value in the range [0,1).
Definition lrand48.c:161
G_math_srand_auto
int G_math_srand_auto(void)
Seed the pseudo-random number generator from the time and PID.
Definition rand1.c:35
G_math_srand
void G_math_srand(int seed)
Seed the pseudo-random number generator.
Definition rand1.c:25
G_math_rand
float G_math_rand(void)
Definition rand1.c:15