I don't know how to write basic for pic, but i remembered that there is a algorithm to build random function as I studied on programming in high school.
The fact that random is not relly random, but it's made from an algorithm that choose one of upto 10^12 matrix elements in Pascal. And if you want, you can make it.
Perhaps you have to review how to generate random function in high level languages, and then do it in PICs. I'm in doubt that high level language for PIC can give random function. If you find out the ans, pls tell meeh. I also care bout it.