Micropolis
random.cpp File Reference

Contains functions for generating random numbers in Micropolis. More...

#include "micropolis.h"

Go to the source code of this file.

Detailed Description

Contains functions for generating random numbers in Micropolis.

This file includes functions for generating random numbers used in various aspects of the Micropolis game. It provides functions for generating random numbers within specific ranges, signed and unsigned random numbers, and a method to initialize the random number generator with a random seed.

Bug:
Code seems to assume that sizeof(short)==2 and sizeof(int)==4 However, this depends on the compiler. We should introduce typedefs for them, and check correctness of our assumptions w.r.t. size of them (eg in Micropolis::randomlySeedRandom() or in Micropolis::Micropolis()).
Bug:
Code stores unsigned 16 bit numbers in short which is a signed type.

Definition in file random.cpp.