Hi,
try with "rand" function in C.
Example:
#include <stdlib.h>
unsigned int result;
.....
result = rand(0x1111);
here it is from Keil help:
The rand function returns a random number in the range 0 to +32767. The random number generator is reinitialized each time a non-zero value is passed in the seed argument. You may use the rand function to delay for a random number of clock cycles or to generate random data to feed into a particular algorithm or input routine.
Example
>rand (0x1234) /* Initialize random generator with 0x1234 */
0x3B98
>rand (0) /* No initialization */
0x64BD
BTW: Which mcu u r using?!?