ae2f_docs
LcgRand.h File Reference
#include <stdint.h>
#include <ae2f/Float.h>
#include <ae2f/Call.h>
#include <ae2f/Cast.h>

Go to the source code of this file.

Classes

union  ae2fCL_LcgRandSeed_t
 Pre-generated 64-bits seed type for separation. (under the hood). More...

Macros

#define ae2f_AnnLcgRandA   1664525
#define ae2f_AnnLcgRandC   1013904223
#define ae2f_AnnLcgRandM   4294967296
#define ae2f_AnnLcgRand(seed)
 Generate a random number from 0 to [ae2f_AnnLcgRandM].
#define ae2f_AnnLcgRandDistribute(n)
 Shrink the 64-bits unsigned integer to [0, 1] in float type.
.
#define ae2f_AnnLcgRandReal(seed)
 Generate a random number as float point from 0 to 1.
#define ae2f_AnnLcgRandG()
#define ae2f_AnnLcgRandRealG()

Typedefs

typedef union ae2fCL_LcgRandSeed_t ae2fCL_LcgRandSeed_t
 Pre-generated 64-bits seed type for separation. (under the hood).

Variables

ae2f_extern ae2f_SHAREDCALL ae2fCL_LcgRandSeed_t ae2f_AnnLcgRandSeed
 Pre-defined global seed.
Simply change this would change the global seed for lcgG.

Detailed Description

Author
ae2f
Version
0.1
Date
2025-02-13

Definition in file LcgRand.h.

Macro Definition Documentation

◆ ae2f_AnnLcgRand

#define ae2f_AnnLcgRand ( seed)
Value:
#define ae2f_AnnLcgRandC
Definition LcgRand.h:18
#define ae2f_AnnLcgRandM
Definition LcgRand.h:19
#define ae2f_AnnLcgRandA
Definition LcgRand.h:17

Generate a random number from 0 to [ae2f_AnnLcgRandM].

Parameters
seed[uint64_t] Seed for random number calculating.
Returns
[uint64_t] Generated random number + possible next seed.

Definition at line 24 of file LcgRand.h.

◆ ae2f_AnnLcgRandA

#define ae2f_AnnLcgRandA   1664525

Definition at line 17 of file LcgRand.h.

◆ ae2f_AnnLcgRandC

#define ae2f_AnnLcgRandC   1013904223

Definition at line 18 of file LcgRand.h.

◆ ae2f_AnnLcgRandDistribute

#define ae2f_AnnLcgRandDistribute ( n)
Value:
ae2f_float ae2f_float_t
Definition Float.h:38

Shrink the 64-bits unsigned integer to [0, 1] in float type.
.

Parameters
n[uint64_t] A 64-bits unsigned integer.
Returns
[ae2f_float_t] [0 ~ 1]

Definition at line 33 of file LcgRand.h.

◆ ae2f_AnnLcgRandG

#define ae2f_AnnLcgRandG ( )
Value:
ae2f_SHAREDEXPORT ae2fCL_LcgRandSeed_t ae2f_AnnLcgRandSeed
Definition LcgRand.c:4
#define ae2f_AnnLcgRand(seed)
Generate a random number from 0 to [ae2f_AnnLcgRandM].
Definition LcgRand.h:24
See also
ae2f_AnnLcgRand

Definition at line 67 of file LcgRand.h.

◆ ae2f_AnnLcgRandM

#define ae2f_AnnLcgRandM   4294967296

Definition at line 19 of file LcgRand.h.

◆ ae2f_AnnLcgRandReal

#define ae2f_AnnLcgRandReal ( seed)
Value:
#define ae2f_AnnLcgRandDistribute(n)
Shrink the 64-bits unsigned integer to [0, 1] in float type. .
Definition LcgRand.h:33

Generate a random number as float point from 0 to 1.

Parameters
seed[uint64_t]
Returns
[ae2f_float_t] Generated number from 0 to 1.

See ae2f_AnnLcgRand ae2f_AnnLcgRandDistribute

Definition at line 44 of file LcgRand.h.

◆ ae2f_AnnLcgRandRealG

#define ae2f_AnnLcgRandRealG ( )
Value:
#define ae2f_AnnLcgRandReal(seed)
Generate a random number as float point from 0 to 1.
Definition LcgRand.h:44
See also
ae2f_AnnLcgRandReal

Definition at line 70 of file LcgRand.h.

Typedef Documentation

◆ ae2fCL_LcgRandSeed_t

typedef union ae2fCL_LcgRandSeed_t ae2fCL_LcgRandSeed_t

Pre-generated 64-bits seed type for separation. (under the hood).

Variable Documentation

◆ ae2f_AnnLcgRandSeed

ae2f_extern ae2f_SHAREDCALL ae2fCL_LcgRandSeed_t ae2f_AnnLcgRandSeed

Pre-defined global seed.
Simply change this would change the global seed for lcgG.

See also
ae2f_AnnLcgRandG
ae2f_AnnLcgRandRealG

Definition at line 64 of file LcgRand.h.