18 lines
335 B
C++
18 lines
335 B
C++
#include <fstream>
|
|
|
|
unsigned long long random_get_seed()
|
|
{
|
|
// Open the random device
|
|
std::ifstream rand_dev("/dev/urandom");
|
|
|
|
// Read some random bytes to get the seed
|
|
unsigned long long seed;
|
|
rand_dev.read((char*)&seed, sizeof(seed));
|
|
|
|
// Close the random device
|
|
rand_dev.close();
|
|
|
|
// Return the seed
|
|
return seed;
|
|
}
|