#pragma once
#include <random>
#include <chrono>


namespace Random {
  extern std::mt19937 GENERATOR;

  template<typename T>
  T uniform(T from, T to) {
    std::uniform_int_distribution<T> rand(from, to);

    return rand(GENERATOR);
  }

  template<typename T>
  T uniform_real(T from, T to) {
    std::uniform_real_distribution<T> rand(from, to);

    return rand(GENERATOR);
  }

  template<typename T>
  T normal(T mean, T stddev) {
    std::normal_distribution<T> rand(mean, stddev);

    return rand(GENERATOR);
  }

  auto abs(auto i, auto j) {
    if(i < j) {
      return Random::uniform(i, j);
    } else if(j < i) {
      return Random::uniform(j, i);
    } else {
      return i;
    }
  }

  std::chrono::milliseconds milliseconds(int from, int to);
}
