AERMRE 1.5.1
AER modding framework for Hyper Light Drifter.
rand.h
Go to the documentation of this file.
1
22#ifndef AER_RAND_H
23#define AER_RAND_H
24
25#include <stdbool.h>
26#include <stddef.h>
27#include <stdint.h>
28
29/* ----- PUBLIC TYPES ----- */
30
38typedef void AERRandGen;
39
40/* ----- PUBLIC FUNCTIONS ----- */
41
52uint64_t AERRandUInt(void);
53
74uint64_t AERRandUIntRange(uint64_t min, uint64_t max);
75
86int64_t AERRandInt(void);
87
108int64_t AERRandIntRange(int64_t min, int64_t max);
109
128float AERRandFloat(void);
129
154float AERRandFloatRange(float min, float max);
155
174double AERRandDouble(void);
175
200double AERRandDoubleRange(double min, double max);
201
212bool AERRandBool(void);
213
229void AERRandShuffle(size_t elemSize, size_t bufSize, void* elemBuf);
230
245AERRandGen* AERRandGenNew(uint64_t seed);
246
260
271void AERRandGenSeed(AERRandGen* gen, uint64_t seed);
272
288
311uint64_t AERRandGenUIntRange(AERRandGen* gen, uint64_t min, uint64_t max);
312
328
351int64_t AERRandGenIntRange(AERRandGen* gen, int64_t min, int64_t max);
352
376
403float AERRandGenFloatRange(AERRandGen* gen, float min, float max);
404
428
455double AERRandGenDoubleRange(AERRandGen* gen, double min, double max);
456
471
488 size_t elemSize,
489 size_t bufSize,
490 void* elemBuf);
491
492#endif /* AER_RAND_H */
void AERRandGenFree(AERRandGen *gen)
Free a self-managed pseudorandom number generator allocated using AERRandGenNew.
uint64_t AERRandUIntRange(uint64_t min, uint64_t max)
Get a pseudorandom unsigned integer on the interval [min, max) using the automatically-seeded global ...
AERRandGen * AERRandGenNew(uint64_t seed)
Allocate and initialize a new self-managed pseudorandom number generator.
float AERRandFloat(void)
Get a pseudorandom floating-point value on the interval [0.0f, 1.0f) using the automatically-seeded g...
double AERRandGenDoubleRange(AERRandGen *gen, double min, double max)
Get a pseudorandom double floating-point value on the interval [min, max) using a self-managed genera...
float AERRandGenFloatRange(AERRandGen *gen, float min, float max)
Get a pseudorandom floating-point value on the interval [min, max) using a self-managed generator.
double AERRandDoubleRange(double min, double max)
Get a pseudorandom double floating-point value on the interval [min, max) using the automatically-see...
void AERRandGen
Opaque type for a self-managed pseudorandom number generator.
Definition: rand.h:38
int64_t AERRandInt(void)
Get a pseudorandom signed integer on the interval [-2^63, 2^63) using the automatically-seeded global...
float AERRandGenFloat(AERRandGen *gen)
Get a pseudorandom floating-point value on the interval [0.0f, 1.0f) using a self-managed generator.
bool AERRandBool(void)
Get a pseudorandom boolean using the automatically-seeded global generator.
void AERRandGenShuffle(AERRandGen *gen, size_t elemSize, size_t bufSize, void *elemBuf)
Shuffle an array of arbitrary elements using a self-managed generator.
bool AERRandGenBool(AERRandGen *gen)
Get a pseudorandom boolean using a self-managed generator.
float AERRandFloatRange(float min, float max)
Get a pseudorandom floating-point value on the interval [min, max) using the automatically-seeded glo...
void AERRandGenSeed(AERRandGen *gen, uint64_t seed)
Re-seed a self-managed pseudorandom number generator.
int64_t AERRandGenIntRange(AERRandGen *gen, int64_t min, int64_t max)
Get a pseudorandom signed integer on the interval [min, max) using a self-managed generator.
int64_t AERRandIntRange(int64_t min, int64_t max)
Get a pseudorandom signed integer on the interval [min, max) using the automatically-seeded global ge...
uint64_t AERRandGenUInt(AERRandGen *gen)
Get a pseudorandom unsigned integer on the interval [0, 2^64) using a self-managed generator.
uint64_t AERRandGenUIntRange(AERRandGen *gen, uint64_t min, uint64_t max)
Get a pseudorandom unsigned integer on the interval [min, max) using a self-managed generator.
uint64_t AERRandUInt(void)
Get a pseudorandom unsigned integer on the interval [0, 2^64) using the automatically-seeded global g...
int64_t AERRandGenInt(AERRandGen *gen)
Get a pseudorandom signed integer on the interval [-2^63, 2^63) using a self-managed generator.
double AERRandGenDouble(AERRandGen *gen)
Get a pseudorandom double floating-point value on the interval [0.0, 1.0) using a self-managed genera...
double AERRandDouble(void)
Get a pseudorandom double floating-point value on the interval [0.0, 1.0) using the automatically-see...
void AERRandShuffle(size_t elemSize, size_t bufSize, void *elemBuf)
Shuffle an array of arbitrary elements using the automatically-seeded global generator.