Dungeonator  1.0.0
a dungeon generator library
util.h File Reference

various utilities used thoughout the code More...

#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include "pcg_basic.h"
#include "direction.h"

Go to the source code of this file.


void seedDungeonatorRNG ()
bool contains (int *arr, size_t start, size_t end, int element)
void shuffleDirections (Direction *array, int n)
int uniform_distribution (int rangeLow, int rangeHigh)

Detailed Description

various utilities used thoughout the code

Function Documentation

◆ contains()

bool contains ( int *  arr,
size_t  start,
size_t  end,
int  element 

test if an int array contains an int

time complexity O(n) (obviously)

[in]arrthe array to check
[in]startthe start index to check from
[in]endthe end index to check to
[in]elementthe element to check for
whether the array contains the element

◆ seedDungeonatorRNG()

void seedDungeonatorRNG ( )

seed the prng used by the dungeon generation algorithm with a non-determentistic seed

◆ shuffleDirections()

void shuffleDirections ( Direction array,
int  n 

shuffle the array of directions

[in,out]arraythe array to shuffle
[in]nthe length of the array

◆ uniform_distribution()

int uniform_distribution ( int  rangeLow,
int  rangeHigh 

get a random number in a uniform distribution of [rangeLow, rangeHigh)

[in]rangeLowthe lower number in the range
[in]rangeHighthe higher number in the range
a random int in the range