Cub3D
 
Loading...
Searching...
No Matches
Random implementation based on libc

Random functions used to generated randomness. More...

Functions

void ft_srand (unsigned int seed)
 Sets the initial random state from the given seed.
 
unsigned int ft_rand (void)
 Generate a random unsigned int.
 
void array_shuffle (int *arr, int len)
 Shuffle an array.
 
int cub_parse_generation_arg (char *gen, size_t *width, size_t *height)
 Parse the argument for generation.
 
t_map_raoulcub_new_map_from_dimensions (char *dimensions)
 Allocates a new map with the given dimension.
 
int cub_growing_tree (t_map_raoul *map)
 Cub3D Maze Generator, uses dimensions from gen, store them in map and create a random perfect maze.
 
int cub_spawn_objects (t_map_raoul *map, int key)
 Spawns a key and a door in the maze.
 

Detailed Description

Random functions used to generated randomness.

Function Documentation

◆ array_shuffle()

void array_shuffle ( int * arr,
int len )

Shuffle an array.

Parameters
[in,out]arrarray to shuffle
[in]lennumber of element to shuffle
Here is the call graph for this function:

◆ cub_growing_tree()

int cub_growing_tree ( t_map_raoul * map)

Cub3D Maze Generator, uses dimensions from gen, store them in map and create a random perfect maze.

Parameters
[in,out]mapmap structure
Returns
int 1 OK, 0 error
Here is the call graph for this function:

◆ cub_new_map_from_dimensions()

t_map_raoul * cub_new_map_from_dimensions ( char * dimensions)

Allocates a new map with the given dimension.

Parameters
[in]dimensionsdimensions
Returns
t_map_raoul* new map on success, NULL otherwise
Here is the call graph for this function:

◆ cub_parse_generation_arg()

int cub_parse_generation_arg ( char * gen,
size_t * width,
size_t * height )

Parse the argument for generation.

Parameters
[in]genargs to parse
[out]widthwidth of future maze
[out]heightheight of future maze
Returns
int

◆ cub_spawn_objects()

int cub_spawn_objects ( t_map_raoul * map,
int key )

Spawns a key and a door in the maze.

Parameters
[in,out]mapPointer to map
[in]keywhether a key should be placed
Returns
1 OK, 0 otherwise
Here is the call graph for this function:

◆ ft_rand()

unsigned int ft_rand ( void )

Generate a random unsigned int.

Returns
unsigned int number generated

◆ ft_srand()

void ft_srand ( unsigned int seed)

Sets the initial random state from the given seed.

Parameters
[in]seedrandom seed