User:Monster Iestyn/Source Code Documentation/m_random.c

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
Online link GitHub entry
File type C source file

Includes

Variables

Key:

PRNG
Name Type Default Attributes Description
randomseed UINT32 0xBADE4404 static Holds the current seed
initialseed UINT32 0xBADE4404 static Holds the initial seed

Functions

Key:

RNG PRNG PRNG (seed management/debugging)
Function name Return type Params Attributes Description
M_RandomFixed fixed_t none Returns a random fixed point number between 0 and FRACUNIT-1
M_RandomByte UINT8 none Returns a random byte (number between 0 and 255)
M_RandomKey INT32 INT32 a Returns a random number between 0 and a-1
M_RandomRange INT32 INT32 a,
INT32 b
Returns a random number from a range (between a and b)
__internal_prng__ fixed_t none ATTRINLINE,
static,
FUNCINLINE
Returns a random fixed point number between 0 and FRACUNIT-1
P_RandomFixed fixed_t none Returns a random fixed point number between 0 and FRACUNIT-1 (wrapper for __internal_prng__)
P_RandomByte UINT8 none Returns a random byte (number between 0 and 255)
P_RandomKey INT32 INT32 a Returns a random number between 0 and a-1
P_RandomRange INT32 INT32 a,
INT32 b
Returns a random number from a range (between a and b)
P_RandomPeek fixed_t none Returns a random byte without modifying randomseed
P_GetRandSeed UINT32 none Returns the current random seed
P_GetInitSeed UINT32 none Returns the initial random seed
P_SetRandSeed void UINT32 seed Sets the random seed
M_RandomizedSeed UINT32 none Gets a randomized seed for setting the random seed