kzc_random.hpp File Reference

Pseudo-random number generators. More...

Classes

struct  KzcRandom
 Structure for pseudo-random number generator. More...
 

Functions

kzsError kzcRandomCreate (const struct KzcMemoryManager *memoryManager, kzS32 seed, struct KzcRandom **out_random)
 Creates a new pseudo random number generator with the given seed. More...
 
kzsError kzcRandomCreateDefault (const struct KzcMemoryManager *memoryManager, struct KzcRandom **out_random)
 Creates a new pseudo random number generator with a seed based on current system time. More...
 
kzsError kzcRandomDelete (struct KzcRandom *random)
 Frees the memory allocated for the given pseudo random number generator. More...
 
struct KzcRandom kzcRandomInline (kzS32 seed)
 Returns a pseudo random number generator without allocating memory for it. More...
 
struct KzcRandom kzcRandomInlineDefault (void)
 Returns a pseudo random number generator without allocating memory for it. More...
 
void kzcRandomSetSeed (struct KzcRandom *random, kzS32 seed)
 Sets the random seed. More...
 
kzFloat kzcRandomFloat (struct KzcRandom *random)
 Returns a random float in the range [0,1[. More...
 
kzInt kzcRandomInteger (struct KzcRandom *random, kzInt min, kzInt max)
 Returns a random integer in the range [min,max[. More...
 

Detailed Description

Pseudo-random number generators.

Copyright 2008-2017 by Rightware. All rights reserved.

Function Documentation

kzsError kzcRandomCreate ( const struct KzcMemoryManager memoryManager,
kzS32  seed,
struct KzcRandom **  out_random 
)

Creates a new pseudo random number generator with the given seed.

kzsError kzcRandomCreateDefault ( const struct KzcMemoryManager memoryManager,
struct KzcRandom **  out_random 
)

Creates a new pseudo random number generator with a seed based on current system time.

kzsError kzcRandomDelete ( struct KzcRandom random)

Frees the memory allocated for the given pseudo random number generator.

struct KzcRandom kzcRandomInline ( kzS32  seed)

Returns a pseudo random number generator without allocating memory for it.

Uses the given seed.

struct KzcRandom kzcRandomInlineDefault ( void  )

Returns a pseudo random number generator without allocating memory for it.

Uses a seed based on current system time.

void kzcRandomSetSeed ( struct KzcRandom random,
kzS32  seed 
)

Sets the random seed.

kzFloat kzcRandomFloat ( struct KzcRandom random)

Returns a random float in the range [0,1[.

kzInt kzcRandomInteger ( struct KzcRandom random,
kzInt  min,
kzInt  max 
)

Returns a random integer in the range [min,max[.

This function provides only 16 bit accuracy