Kernel: Improve random number generation for unsigned types
This commit is contained in:
parent
076f1efecb
commit
a1b3490764
|
@ -11,14 +11,12 @@ namespace Kernel
|
|||
static void initialize();
|
||||
static uint32_t get_u32();
|
||||
static uint64_t get_u64();
|
||||
template<typename T>
|
||||
static T get();
|
||||
template<BAN::unsigned_integral T> requires (sizeof(T) == 4)
|
||||
static T get() { return Random::get_u32(); }
|
||||
template<BAN::unsigned_integral T> requires (sizeof(T) == 8)
|
||||
static T get() { return Random::get_u64(); }
|
||||
};
|
||||
|
||||
template<>
|
||||
inline uint32_t Random::get<uint32_t>() { return Random::get_u32(); }
|
||||
|
||||
template<>
|
||||
inline uint64_t Random::get<uint64_t>() { return Random::get_u64(); }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue