Axis2/C: rand

- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# rand
[utilities]

## Files
file | axutil_rand.h
| A simple thread safe and reentrant random number generator.

## Functions
AXIS2_EXTERN int | axutil_rand (unsigned int *seedp)
AXIS2_EXTERN int | axutil_rand_with_range (unsigned int *seedp, int start, int end)
AXIS2_EXTERN unsigned int | axutil_rand_get_seed_value_based_on_time (const axutil_env_t *env)

## Function Documentation

AXIS2_EXTERN int axutil_rand | ( | unsigned int * | seedp | ) |

This is reentrant and thread safe simple random number generator function. it is passed an pointer to an unsigned int state value which is used inside the function and changed in each call.

Parameters:

  | seedp | pointer to an unsigned int used as the internal state

Returns:
  int `int```

AXIS2_EXTERN unsigned int axutil_rand_get_seed_value_based_on_time | ( | const axutil_env_t * | env | ) |

A random seed value generated based on the time

AXIS2_EXTERN int axutil_rand_with_range | ( | unsigned int * | seedp,
|  | int | start,
|  | int | end |
| ) |  |  |

This is reentrant and thread safe simple random number generator function. it is passed an pointer to an unsigned int state value which is used inside the function and changed in each call. Also it is passed a range in which the random number is selected

Parameters:

  | seedp | pointer to an unsigned int used as the internal state
  | start | start of the range
  | end | end of the range

Returns:
  int If invalid range is entered -1 is returned `int```