You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shuffle3/src/rng/drng.cpp

22 lines
302 B

#include <cstdlib>
#include <ctime>
#include <iostream>
#include <rng/drng.hpp>
namespace rng
{
drng drng::from_time() { return drng(time(NULL)); }
int drng::rand()
{
return rand_r(&state);
}
double drng::sample()
{
int val = rand_r(&state);
return (double)val / (double)RAND_MAX;
}
}