Bandicoot
Bandicoot

Reputation: 3949

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 ?

Upvotes: 10

Views: 25261

Answers (1)

Jeyaram
Jeyaram

Reputation: 9474

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

Upvotes: 16

Related Questions