mirror of
https://github.com/rdolbeau/VexRiscvBPluginGenerator.git
synced 2025-04-18 18:44:42 -04:00
19 lines
374 B
C++
19 lines
374 B
C++
#include <random>
|
|
#include <functional>
|
|
|
|
std::default_random_engine generator;
|
|
std::uniform_int_distribution<unsigned char> distribution(0,255);
|
|
auto rbyte = std::bind ( distribution, generator );
|
|
|
|
extern "C" {
|
|
void kernelrandombytes(unsigned char *x,unsigned long long xlen)
|
|
{
|
|
int i;
|
|
|
|
while (xlen > 0) {
|
|
*x = rbyte();
|
|
x++;
|
|
xlen--;
|
|
}
|
|
}
|
|
}
|