Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/josh0xA/rrgen
A Header Only C++ Library for Storing Safe, Randomly Generated Data Into Modern Containers
https://github.com/josh0xA/rrgen
Last synced: about 2 months ago
JSON representation
A Header Only C++ Library for Storing Safe, Randomly Generated Data Into Modern Containers
- Host: GitHub
- URL: https://github.com/josh0xA/rrgen
- Owner: josh0xA
- License: mit
- Created: 2020-04-27T04:38:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-05T20:33:16.000Z (8 months ago)
- Last Synced: 2024-05-11T00:34:52.336Z (5 months ago)
- Language: C++
- Homepage:
- Size: 1.01 MB
- Stars: 527
- Watchers: 25
- Forks: 89
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rrgen - A Header Only C++ Library For Storing Safe, Randomly Generated Data Into Modern Containers
## About
This library was developed to combat insecure methods of storing random data into modern C++ containers. For example, old and clunky PRNGs. Thus, rrgen uses STL's distribution engines in order to efficiently and safely store a random number distribution into a given C++ container.## Installation
1) ``git clone https://github.com/josh0xA/rrgen.git``
2) ``cd rrgen``
3) ``make``
4) Add ``include/rrgen.hpp`` to your project tree for access to the library classes and functions.## Official Documentation
*rrgen/docs/index.rst*## Supported Containers
1) ``std::vector<>``
2) ``std::list<>``
3) ``std::array<>``
4) ``std::stack<>``## Example Usages
```cpp
#include "../include/rrgen.hpp"
#includeint main(void)
{
// Example usage for rrgen vector
rrgen::rrand rrvec;
rrvec.gen_rrvector(false, true, 0, 10);
for (auto &i : rrvec.contents())
{
std::cout << i << " ";
} // ^ the same as rrvec.show_contents()// Example usage for rrgen list (frontside insertion)
rrgen::rrand rrlist;
rrlist.gen_rrlist(false, true, "fside", 5, 25);
std::cout << '\n'; rrlist.show_contents();
std::cout << "Size: " << rrlist.contents().size() << '\n';// Example usage for rrgen array
rrgen::rrand_array rrarr;
rrarr.gen_rrarray(false, true, 5, 35);
for (auto &i : rrarr.contents())
{
std::cout << i << " ";
} // ^ the same as rrarr.show_contents()// Example usage for rrgen stack
rrgen::rrand_stack rrstack;
rrstack.gen_rrstack(false, true, 200, 1000);
for (auto m = rrstack.xsize(); m > 0; m--)
{
std::cout << rrstack.grab_top() << " ";
rrstack.pop_off();
if (m == 1) { std::cout << '\n'; }
}
}
```
Note: This is a transferred repository, from a completely unrelated project.## License
MIT License
Copyright (c) Josh Schiavone