-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed rnd module to be more concise
- Loading branch information
Showing
14 changed files
with
286 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# CF_Rnd | ||
# cf_rnd | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
A random number generator. | ||
Returns a random `uint64_t`. | ||
|
||
Struct Members | Description | ||
--- | --- | ||
`uint64_t state[2]` | Just two `uint64_t`'s for the internal state. Very small! These are setup by [cf_rnd_seed](/random/cf_rnd_seed.md). | ||
|
||
## Remarks | ||
```cpp | ||
uint64_t cf_rnd(CF_RndState* rnd); | ||
``` | ||
A random number generator of the type LFSR (linear feedback shift registers). This specific | ||
implementation uses the XorShift+ variation, and returns 64-bit random numbers. More information | ||
can be found on Wikipedia. | ||
https://en.wikipedia.org/wiki/Xorshift | ||
|
||
This implementation comes from Mattias Gustavsson's single-file header collection. | ||
https://github.com/mattiasgustavsson/libs/blob/main/rnd.h | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[cf_rnd_next](/random/cf_rnd_next.md) | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_double | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `double`. | ||
|
||
```cpp | ||
double cf_rnd_double(CF_RndState* rnd); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_float | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `float`. | ||
|
||
```cpp | ||
float cf_rnd_float(CF_RndState* rnd); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_range_double | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `double` from the range `min` to `max` (inclusive). | ||
|
||
```cpp | ||
double cf_rnd_range_double(CF_RndState* rnd, double min, double max); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_range_float | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `float` from the range `min` to `max` (inclusive). | ||
|
||
```cpp | ||
float cf_rnd_range_float(CF_RndState* rnd, float min, float max); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_range_int | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `int` from the range `min` to `max` (inclusive). | ||
|
||
```cpp | ||
int cf_rnd_range_int(CF_RndState* rnd, int min, int max); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) | ||
[cf_rnd_range_uint64](/random/cf_rnd_range_uint64.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# cf_rnd_range_uint64 | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
Returns a random `uint64_t` from the range `min` to `max` (inclusive). | ||
|
||
```cpp | ||
uint64_t cf_rnd_range_uint64(CF_RndState* rnd, uint64_t min, uint64_t max); | ||
``` | ||
Parameters | Description | ||
--- | --- | ||
rnd | The random number generator state. | ||
## Related Pages | ||
[CF_RndState](/random/cf_rndstate.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) | ||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_float](/random/cf_rnd_float.md) | ||
[cf_rnd_double](/random/cf_rnd_double.md) | ||
[cf_rnd_range_int](/random/cf_rnd_range_int.md) | ||
[cf_rnd_range_double](/random/cf_rnd_range_double.md) | ||
[cf_rnd_range_float](/random/cf_rnd_range_float.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[](../header.md ':include') | ||
|
||
# CF_RndState | ||
|
||
Category: [random](/api_reference?id=random) | ||
GitHub: [cute_rnd.h](https://github.com/RandyGaul/cute_framework/blob/master/include/cute_rnd.h) | ||
--- | ||
|
||
A random number generator. | ||
|
||
Struct Members | Description | ||
--- | --- | ||
`uint64_t state[2]` | Just two `uint64_t`'s for the internal state. Very small! These are setup by [cf_rnd_seed](/random/cf_rnd_seed.md). | ||
|
||
## Remarks | ||
|
||
A random number generator of the type LFSR (linear feedback shift registers). This specific | ||
implementation uses the XorShift+ variation, and returns 64-bit random numbers. More information | ||
can be found on Wikipedia. | ||
https://en.wikipedia.org/wiki/Xorshift | ||
|
||
This implementation comes from Mattias Gustavsson's single-file header collection. | ||
https://github.com/mattiasgustavsson/libs/blob/main/rnd.h | ||
|
||
## Related Pages | ||
|
||
[cf_rnd](/random/cf_rnd.md) | ||
[cf_rnd_seed](/random/cf_rnd_seed.md) |
Oops, something went wrong.