Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robloach/prand.h
Pseudo-Random Number Generator for C89
https://github.com/robloach/prand.h
c89 header-only single-header
Last synced: about 4 hours ago
JSON representation
Pseudo-Random Number Generator for C89
- Host: GitHub
- URL: https://github.com/robloach/prand.h
- Owner: RobLoach
- License: zlib
- Created: 2023-10-30T07:24:23.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-05-16T19:29:00.000Z (4 months ago)
- Last Synced: 2024-05-16T20:40:15.767Z (4 months ago)
- Topics: c89, header-only, single-header
- Language: C
- Homepage:
- Size: 30.3 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# prand
Pseudo-random number generator for C89, based off [raylib](https://www.raylib.com/)'s [rprand.h](https://github.com/raysan5/raylib/blob/master/src/external/rprand.h).
## API
``` c
void prand_init(prand_t* prand, uint64_t seed);
uint32_t prand_rand(prand_t* prand);
int prand_int(prand_t* prand, int min, int max);
uint32_t prand_uint32(prand_t* prand, uint32_t min, uint32_t max);
unsigned int prand_uint(prand_t* prand, unsigned int min, unsigned int max);
float prand_float(prand_t* prand, float min, float max);
```## Example
``` c
#define PRAND_IMPLEMENTATION
#include "../prand.h"#include
int main() {
prand_t prand;
prand_init(&prand, 0);int result = prand_int(&prand, -100, 200);
printf("Random: %d\n", result);return 0;
}
```## License
[zlib](LICENSE)