title: linux get_random_bytes error: implicit declaration of function
body: <p>I have to make a device driver for a Yahtzee program that returns a random number 1-6.  I am very new to Linux and am really not comfortable with programming in it.  I keep getting an erro for the get_random_bytes function.  It says, error: implicit declaration of function ‘get_random_bytes’  Here is my code so far:</p>
  
  <pre><code>    static ssize_t dice_driver_read(struct file * file, char * buf,
                        size_t count, loff_t *ppos)
       {
  
      unsigned char i;
      int len = 1;
      get_random_bytes(&amp;i, sizeof(char));
  
     // char *dice_driver_str = "Hello, world!\n";
     // int len = strlen(dice_driver_str); /* Don't include the null byte. */
      /*
       * We only support reading the whole string at once.
       */
  if (count &lt; len){
              return -EINVAL;}
      /*
       * If file position is non-zero, then assume the string has
       * been read and indicate there is no more data to be read.
       */
  if (*ppos != 0){
              return 0;}
      /*
       * Besides copying the string to the user provided buffer,
       * this function also checks that the user has permission to
       * write to the buffer, that it is mapped, etc.
       */
  
      if (copy_to_user(buf, i, 1))
              {return -EINVAL;}
      /*
       * Tell the user how much data we wrote.
       */
      *ppos = len;
  
      return len;
      }  
  </code></pre>
  
  <p>If someone could point out to me why this is happening I would greatly appreciate it. This was also taken from a hello world code, so the extra stuff is from that. Thanks</p>