Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/youpong/randomengine
A practical guide to implementing a custom random number generator and integrating it with std::uniform_int_distribution.
https://github.com/youpong/randomengine
cpp-standard-library cpp20 dockerfile
Last synced: 1 day ago
JSON representation
A practical guide to implementing a custom random number generator and integrating it with std::uniform_int_distribution.
- Host: GitHub
- URL: https://github.com/youpong/randomengine
- Owner: youpong
- License: mit
- Created: 2024-11-14T16:41:47.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-01-18T08:55:45.000Z (9 days ago)
- Last Synced: 2025-01-18T09:33:12.776Z (9 days ago)
- Topics: cpp-standard-library, cpp20, dockerfile
- Language: C++
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RandomEngine
Provides a practical demonstration of how to implement a custom random number
generator and use it in conjunction with the standard `std::uniform_int_distribution`.
This also includes a Dockerfile for building a docker environment.## Requisite
written in C++20, you will need a recent version of a C++ compiler and C++ standard
library.## Tested Environment
We are testing in the following environments:
* macOS 15.2
* Xcode 16.2 (using the bundled Apple Clang 16.0.0)
* Ubuntu 24.04.1 LTS
* GCC 13.3.0
* Clang 18.1.3## How to Build
```
$ make main
```## How to Run
Displays the results of rolling the dice 10 times.
```
$ make run
```## Setting Up a Docker Environment for Build/Run
This project supports building and testing within a Docker container. The
process mirrors the standard procedure, ensuring consistency across environments.### Key Points
- The Docker image is based on `Ubuntu`.
- Building and testing inside the container follow the same steps as running
directly on a native system.### Steps
#### Build Docker image `rnd`
```
$ docker build -t rnd .
```#### Create and run a new container from an image
```
$ docker run --rm -it -v $PWD:/rnd -w /rnd rnd
```## References
* "Linear congruential generator." *Wikipedia*. 2024. [https://en.wikipedia.org/wiki/Linear_congruential_generator#cite_note-LEcuyer99-10](https://en.wikipedia.org/wiki/Linear_congruential_generator#cite_note-LEcuyer99-10).
* 江添亮. *江添亮のC++入門*. ドワンゴ, 2019, Kindle版, 39.3 乱数分布.
## LICENSE
MIT