The mame_rand() function returns a standardized random number.
Declared in src/emu/mame.h as
UINT32 mame_rand(running_machine *machine);
*machine – Pointer to the currently running machine.A random number.
UINT32 number = mame_rand(Machine);
Will store a random number into the variable number.