A good way to get a random number is to use the one out of the C library like monkeyboy said, and seed it with an external hardware counter that you let count away independently (avalon slave that you can read from). The seed value helps randomize the rand() call so that you don't get the same "random" sequence each time. Having an external counter isn't going to be perfect but it will give you a much more random sequence since the likelyhood of the value producing the same seed all the time is going to be really rare.