<commit_before>/* Random.hpp
 *
 * <NAME>
 */

#ifndef SUNFISH_COMMON_MATH_RANDOM_HPP__
#define SUNFISH_COMMON_MATH_RANDOM_HPP__

#include "common/Def.hpp"
#include <random>
#include <algorithm>
#include <ctime>
#include <cstdint>

namespace sunfish {

template <class GenType>
class BaseRandom {
public:
  BaseRandom() : rgen(static_cast<unsigned>(time(NULL))) {
  }
  BaseRandom(const BaseRandom&) = delete;
  BaseRandom(BaseRandom&&) = delete;

  uint16_t int16() {
    std::uniform_int_distribution<uint16_t> dst16;
    return dst16(rgen);
  }

  uint16_t int16(uint16_t num) {
    std::uniform_int_distribution<uint16_t> dst16(0, num-1);
    return int16() % num;
  }

  uint32_t int32() {
    std::uniform_int_distribution<uint32_t> dst32;
    return dst32(rgen);
  }

  uint32_t int32(uint32_t num) {
    std::uniform_int_distribution<uint32_t> dst32(0, num-1);
    return int32() % num;
  }

  uint64_t int64() {
    std::uniform_int_distribution<uint64_t> dst64;
    return dst64(rgen);
  }

  uint64_t int64(uint64_t num) {
    std::uniform_int_distribution<uint64_t> dst64(0, num-1);
    return int64() % num;<commit_msg>Fix Random class<commit_after>/* Random.hpp
 *
 * <NAME>
 */

#ifndef SUNFISH_COMMON_MATH_RANDOM_HPP__
#define SUNFISH_COMMON_MATH_RANDOM_HPP__

#include "common/Def.hpp"
#include <random>
#include <algorithm>
#include <ctime>
#include <cstdint>

namespace sunfish {

template <class GenType>
class BaseRandom {
public:
  BaseRandom() : rgen(static_cast<unsigned>(time(NULL))) {
  }
  BaseRandom(const BaseRandom&) = delete;
  BaseRandom(BaseRandom&&) = delete;

  uint16_t int16() {
    std::uniform_int_distribution<uint16_t> dst16;
    return dst16(rgen);
  }

  uint16_t int16(uint16_t num) {
    std::uniform_int_distribution<uint16_t> dst16(0, num-1);
    return dst16(rgen);
  }

  uint32_t int32() {
    std::uniform_int_distribution<uint32_t> dst32;
    return dst32(rgen);
  }

  uint32_t int32(uint32_t num) {
    std::uniform_int_distribution<uint32_t> dst32(0, num-1);
    return dst32(rgen);
  }

  uint64_t int64() {
    std::uniform_int_distribution<uint64_t> dst64;
    return dst64(rgen);
  }

  uint64_t int64(uint64_t num) {
    std::uniform_int_distribution<uint64_t> dst64(0, num-1);
    return dst64(rgen);
{'fraction_non_alphanumeric': 0.12781954887218044, 'fraction_numerical': 0.06368863334807608, 'mean_word_length': 4.726582278481013, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5256250', 'n_tokens_mistral': 979, 'n_tokens_neox': 883, 'n_words': 152}