Files
Anghelo Carvajal 6dd1600936 Organize libc64 files (#1492)
* Move qrand to libc64

* use an union to avoid type punning

* __osMalloc

* math64.c

* fixed_point.h

* sleep

* aprintf.h

* sprintf

* malloc

* use original names on aprintf.c and malloc.c

* qrand cleanup pass

* use original names of sleep.c

* og names for sprintf

* more cleanup

* format

* fixes

* whoops

* use ARRAY_COUNT again

* comment

* Use `fu`

* forgot this one

* review

* fix

* sneak a tiny cleanup
2023-11-27 12:01:42 +11:00

24 lines
703 B
C

#ifndef LIBC64_QRAND_H
#define LIBC64_QRAND_H
#include "ultra64.h"
//! These values are recommended by the algorithms book *Numerical Recipes in C. The Art of Scientific Computing*, 2nd
//! Edition, 1992, ISBN 0-521-43108-5. (p. 284):
//! > This is about as good as any 32-bit linear congruential generator, entirely adequate for many uses.
#define RAND_MULTIPLIER 1664525
#define RAND_INCREMENT 1013904223
u32 Rand_Next(void);
void Rand_Seed(u32 seed);
f32 Rand_ZeroOne(void);
f32 Rand_Centered(void);
void Rand_Seed_Variable(u32* rndNum, u32 seed);
u32 Rand_Next_Variable(u32* rndNum);
f32 Rand_ZeroOne_Variable(u32* rndNum);
f32 Rand_Centered_Variable(u32* rndNum);
extern fu gRandFloat;
#endif