samedi 7 avril 2018

Using 'getrandom' for rng in C++

So, I want to make a random-number-generator in c++ (which I am new to) and would like to make a maths quiz with randomly-generated numbers. My problem is that using time(0) is only accurate to a single second. In the IDE that I am using, NetBeans 8.2, a message appeared when hovering over srand(time(0)) with the message 'This is a weak random number generator; it is not useful for security purposes. Alternative: getrandom(void *buf,size_t buflen, unsigned int flags);/dev/urandom' (Image of the text) and I could not find anything online about 'getrandom'. I was wondering if anyone could shed some light on the syntax of 'getrandom'/how to use it. Thanks in advance? :)




Aucun commentaire:

Enregistrer un commentaire