who who

how to generate a random number--MC1321x

Discussion created by who who on Jul 14, 2008
Latest reply on Jul 17, 2008 by who who
Dear all:
I'm using MC13213 and CodeWarrior6.1,now I want to get a random number with following C code:
clock_t clk;
unsigned int random_number;
clk = clock();               //clock always return zero,so clk is equal to zero
srand((int)clk);             //feed always is zero
random_number = rand();      //the random_number is a constant every time running, not a random

I don't konw why the clock always return 0,how to solve it ?
Otherwise,call the time(),it also returns 0.
look forward to your suggestion!
Thanks and best regards!