proconlib

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub KodamaD/proconlib

:warning: random/rand_real.cpp

Depends on

Required by

Code

#pragma once
#include <random>
#include "xorshift.cpp"

template <class T> T rand_real(const T& min, const T& max) {
    static std::default_random_engine gen(xorshift());
    return std::uniform_real_distribution<T>(min, max)(gen);
}
#line 2 "random/rand_real.cpp"
#include <random>
#line 2 "random/xorshift.cpp"
#include <chrono>
#line 2 "utility/int_alias.cpp"
#include <cstdint>

using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
#line 5 "random/xorshift.cpp"

u64 xorshift() {
    static u64 state = std::chrono::system_clock::now().time_since_epoch().count();
    state ^= state << 7;
    state ^= state >> 9;
    return state;
}
#line 4 "random/rand_real.cpp"

template <class T> T rand_real(const T& min, const T& max) {
    static std::default_random_engine gen(xorshift());
    return std::uniform_real_distribution<T>(min, max)(gen);
}
Back to top page