Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
random.c File Reference

Random number generation utilities. More...

#include <random.h>

Functions

void RandomInit ()
 [Start] Initializes the random number generator
 
int RandInt (int min, int max)
 [Utility] Generates a random integer within a range
 
float RandFloat (float min, float max)
 [Utility] Generates a random float within a range
 
bool RandBool ()
 [Utility] Generates a random boolean value
 

Detailed Description

Random number generation utilities.

Provides functions for generating random integers, floats, and booleans within specified ranges. Includes seed initialization.

Author
Mango
Date
2025-03-05

Function Documentation

◆ RandBool()

bool RandBool ( )

[Utility] Generates a random boolean value

Generates a random boolean value.

Returns either true or false with equal probability (50%).

Returns
bool Either true or false

◆ RandFloat()

float RandFloat ( float  min,
float  max 
)

[Utility] Generates a random float within a range

Generates a random float between min and max.

Creates a random floating-point value that is >= min and <= max. The distribution is uniform across the range.

Parameters
minThe minimum value (inclusive)
maxThe maximum value (inclusive)
Returns
float A random float between min and max

◆ RandInt()

int RandInt ( int  min,
int  max 
)

[Utility] Generates a random integer within a range

Generates a random integer between min and max (inclusive).

Creates a random integer value that is >= min and <= max. The distribution is uniform across the range.

Parameters
minThe minimum value (inclusive)
maxThe maximum value (inclusive)
Returns
int A random integer between min and max

◆ RandomInit()

void RandomInit ( )

[Start] Initializes the random number generator

Initializes the random number generator.

Seeds the random number generator with a time-based value to ensure different sequences on each program run.