Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate random number in kernel module

Is there a rand() equivalent function in Linux that I can call in kernel space i.e. say from inside a kernel module ?

like image 709
Bandicoot Avatar asked Oct 18 '12 18:10

Bandicoot


1 Answers

The get_random_bytes() routine returns the requested number of random bytes and stores them in a buffer. This routine is for kernel modules that cannot be in a wait state.

http://www.linuxquestions.org/questions/programming-9/random-numbers-kernel-642087/

http://www.spinics.net/lists/newbies/msg00062.html

like image 63
Jeyaram Avatar answered Sep 30 '22 21:09

Jeyaram