lcd "random fruit" built in function for pic
You need a random number.

That's what the STDLIB rand() is for.


  Function returns a sequence of pseudo-random numbers between 0 and 32767. The function will always produce the same sequence of numbers unless srand is called to seed the start point.


Divide the result of result = rand() by the number of fruit you have to bring it down to a smaller range.

Then just use that number.

 if (result &lt;= 30) then fruit1();
 else if (result &lt;= 60) then fruit2();
 etc.


Use srand() to change the random number seed, or you will get the same set of "random" numbers eventually.