Skip to content

A C++11 header-only implementation of the TinyMT pseudo-random number generator.

License

Notifications You must be signed in to change notification settings

tueda/tinymt-cpp

Repository files navigation

tinymt-cpp

CI Documentation Status Codecov Language grade: C/C++

A C++11 header-only implementation of the TinyMT pseudo-random number generator.

tinymt-cpp is a one-header-file library written in C++11, which implements a pseudo-random number generator engine based on the TinyMT algorithms. It can be used in the same way as random number generators in the standard library and combined with random number distributions.

Example

#include <iostream>
#include <tinymt/tinymt.h>

int main() {
  tinymt::tinymt32 rng;

  std::cout << rng() << std::endl;
  std::cout << rng() << std::endl;

  return 0;
}

Development

# Prerequisites (including optional ones)
brew install cmake doxygen gcc lcov llvm pre-commit

# Pre-commit hooks.
pre-commit install
pre-commit install --hook-type commit-msg

# Linters.
pre-commit run --all-files

# Tests.
cmake -S . -B build/debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug --target check

# Documents.
cmake -S . -B build/docs -DBUILD_TESTING=OFF
cmake --build build/docs --target doc

# Code coverage.
cmake -S . -B build/coverage -DCMAKE_BUILD_TYPE=Debug -DUSE_CODE_COVERAGE=ON
lcov -z -d build/coverage
cmake --build build/coverage --target check
lcov -c -d build/coverage -o build/coverage/coverage.info
genhtml -o build/coverage/html build/coverage/coverage.info

# Compiler sanitizers.
cmake -S . -B build/sanitizer -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER=ON
cmake --build build/sanitizer --target check

# Clang-Tidy.
cmake -S . -B build/clang-tidy -DCMAKE_BUILD_TYPE=Debug -DUSE_CLANG_TIDY=ON
cmake --build build/clang-tidy --target check

# Benchmarking.
cmake -S . -B build/release -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCHMARKING=ON
cmake --build build/release --target bench

License

BSD-3-Clause

References

About

A C++11 header-only implementation of the TinyMT pseudo-random number generator.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published