eolib 0.5.0
A core C library for writing applications related to Endless Online
Loading...
Searching...
No Matches
rng.c File Reference
#include "eolib/rng.h"

Go to the source code of this file.

Functions

void eo_srand (uint32_t seed)
uint32_t eo_rand ()
uint32_t eo_rand_range (uint32_t min, uint32_t max)

Variables

static uint32_t state_high
static uint32_t current_seed

Function Documentation

◆ eo_rand()

uint32_t eo_rand ( )

Generate a pseudo-random 32-bit unsigned integer. The sequence of numbers generated depends on the seed set by eo_srand().

Remarks
Emulates the behavior of the original game client.

Definition at line 12 of file rng.c.

◆ eo_rand_range()

uint32_t eo_rand_range ( uint32_t min,
uint32_t max )

Generate a pseudo-random 32-bit unsigned integer within a specified range [min, max]. The sequence of numbers generated depends on the seed set by eo_srand().

Definition at line 38 of file rng.c.

◆ eo_srand()

void eo_srand ( uint32_t seed)

Seed the random number generator with a 32-bit unsigned integer. The same seed will produce the same sequence of random numbers. The seed is transformed internally to initialize the generator's state.

Definition at line 6 of file rng.c.

Variable Documentation

◆ current_seed

uint32_t current_seed
static

Definition at line 4 of file rng.c.

◆ state_high

uint32_t state_high
static

Definition at line 3 of file rng.c.