GRASS 8 Programmer's Manual
8.5.0(2026)-8d6ceba290
Toggle main menu visibility
Loading...
Searching...
No Matches
rand1.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include <grass/gis.h>
3
#include <grass/gmath.h>
4
5
/*!
6
* \fn float G_math_rand (int seed)
7
*
8
* \brief Random Number Generator (Uniform)
9
*
10
* Random number generator (Uniform Derivatives 0.0 -> 1.0)
11
*
12
* \param[in] seed
13
* \return float
14
*/
15
float
G_math_rand
(
void
)
16
{
17
return
G_drand48
();
18
}
19
20
/*!
21
* \brief Seed the pseudo-random number generator
22
*
23
* \param[in] seed 32-bit integer used to seed the PRNG
24
*/
25
void
G_math_srand
(
int
seed)
26
{
27
G_srand48
(seed);
28
}
29
30
/*!
31
* \brief Seed the pseudo-random number generator from the time and PID
32
*
33
* \return generated seed value passed to G_srand48()
34
*/
35
int
G_math_srand_auto
(
void
)
36
{
37
return
(
int
)
G_srand48_auto
();
38
}
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
gmath
rand1.c
Generated on
for GRASS 8 Programmer's Manual by
1.17.0