High-Level Data Reduction Library: hdrl_random.c File Reference

High-Level Data Reduction Library 1.6.0 High-Level data reduction routines for ESO pipelines

Loading...
Searching...
No Matches
Data Structures | Functions
hdrl_random.c File Reference
`#include <hdrl_random.h>`
`#include <stdint.h>`
`#include <math.h>`
Include dependency graph for hdrl_random.c:

## Data Structures
struct | hdrl_random_state_

## Functions
hdrl_random_state * | hdrl_random_state_new (int type, uint64_t *seed)
| create random number generator state
void | hdrl_random_state_delete (hdrl_random_state *state)
| delete random number generator state structure
int64_t | hdrl_random_uniform_int64 (hdrl_random_state *state, int64_t minval, int64_t maxval)
| generatore uniformly distributed 64 bit integers within range
double | hdrl_random_uniform_double (hdrl_random_state *state, double minval, double maxval)
| generatore uniformly distributed double within range
uint64_t | hdrl_random_poisson (hdrl_random_state *state, double lam)
| generatore poisson distributed values
double | hdrl_random_normal (hdrl_random_state *state, double mean, double sigma)
| generatore normal distributed values

## Function Documentation

## ◆ hdrl_random_normal()

double hdrl_random_normal | ( | hdrl_random_state * | state,
|  | double | mean,
|  | double | sigma
| ) |  |

generatore normal distributed values

Parameters

  state | rng state
  mean | mean/location parameter of normal distribution
  sigma | sigma/scale parameter of normal distribution

Returns
  normal distributed value

## ◆ hdrl_random_poisson()

uint64_t hdrl_random_poisson | ( | hdrl_random_state * | state,
|  | double | lam
| ) |  |

generatore poisson distributed values

Parameters

  state | rng state
  lam | lambda/mean parameter of poisson distribution

Returns
  poisson distributed value

## ◆ hdrl_random_state_delete()

void hdrl_random_state_delete | ( | hdrl_random_state * | state | ) |

delete random number generator state structure

Parameters

  state |

## ◆ hdrl_random_state_new()

hdrl_random_state * hdrl_random_state_new | ( | int | type,
|  | uint64_t * | seed
| ) |  |

create random number generator state

Parameters

  type | type, currently needs to be 1 for pcg generator
  seed | seed array, length depends on used generator, if NULL uses rand() to seed for pcg: two integers state and streamid

Returns
  random number generator state structure, must be deleted with hdrl_random_state_delete

## ◆ hdrl_random_uniform_double()

double hdrl_random_uniform_double | ( | hdrl_random_state * | state,
|  | double | minval,
|  | double | maxval
| ) |  |

generatore uniformly distributed double within range

Parameters

  state | rng state
  minval | minimum value, inclusive
  maxval | maximum value, inclusive

Returns
  uniformly distributed double within range

## ◆ hdrl_random_uniform_int64()

int64_t hdrl_random_uniform_int64 | ( | hdrl_random_state * | state,
|  | int64_t | minval,
|  | int64_t | maxval
| ) |  |

generatore uniformly distributed 64 bit integers within range

Parameters

  state | rng state
  minval | minimum value, inclusive
  maxval | maximum value, inclusive

Returns
  uniformly distributed 64 bit integer within range