2 Replies Latest reply on Nov 5, 2013 1:33 PM by Intel_Glen

    How to use the random() function


      Does anyone know how to properly use the random() function?  It's not working the way Arduino documentation says it should.  I've used the following different options and still get the same compiler error:


      int a = random(10);

      int a = random(0, 10);

      long int a = random(10);

      unsigned int a = random(10);

      float a = random(10);


      The complier error is: error: too many arguments to function 'long int random()'


      Oddly, if I leave out any arguments like int a = random();  I don't get an error.  But I need to define the range of the random number I want to generate.  The function randomSeed() also doesn't seem to work right.  I get this error when trying to use it:

      error: 'randomSeed' was not declared in this scope