#include <stdint.h>
#include <ae2f/Float.h>
#include <ae2f/Call.h>
#include <ae2f/Cast.h>
Go to the source code of this file.
|
|
typedef union ae2fCL_LcgRandSeed_t | ae2fCL_LcgRandSeed_t |
| | Pre-generated 64-bits seed type for separation. (under the hood).
|
- Author
- ae2f
- Version
- 0.1
- Date
- 2025-02-13
- Copyright
- Copyright (c) 2025
Definition in file LcgRand.h.
◆ ae2f_AnnLcgRand
| #define ae2f_AnnLcgRand |
( |
| seed | ) |
|
Value:((ae2f_AnnLcgRandA * (seed) + ae2f_AnnLcgRandC) % ae2f_AnnLcgRandM)
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 |
◆ ae2f_AnnLcgRandC
| #define ae2f_AnnLcgRandC 1013904223 |
◆ ae2f_AnnLcgRandDistribute
| #define ae2f_AnnLcgRandDistribute |
( |
| n | ) |
|
Value:(((ae2f_float_t)(n)) / ((ae2f_float_t)ae2f_AnnLcgRandM))
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_extern ae2f_SHAREDCALL ae2fCL_LcgRandSeed_t ae2f_AnnLcgRandSeed
Pre-defined global seed. Simply change this would change the global seed for lcgG.
#define ae2f_AnnLcgRand(seed)
Generate a random number from 0 to [ae2f_AnnLcgRandM].
- See also
- ae2f_AnnLcgRand
Definition at line 67 of file LcgRand.h.
◆ ae2f_AnnLcgRandM
| #define ae2f_AnnLcgRandM 4294967296 |
◆ ae2f_AnnLcgRandReal
| #define ae2f_AnnLcgRandReal |
( |
| seed | ) |
|
Value:
#define ae2f_AnnLcgRandDistribute(n)
Shrink the 64-bits unsigned integer to [0, 1] in float type. .
Generate a random number as float point from 0 to 1.
- Parameters
-
- 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.
- See also
- ae2f_AnnLcgRandReal
Definition at line 70 of file LcgRand.h.
◆ ae2f_AnnLcgRandSeed