This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to generate random numbers on TMS320x28x

Other Parts Discussed in Thread: CCSTUDIO

Hi,

Im very new in embedded coding. I would like to generate a random number. Im using CCStudio and coding in C. Can I use the tipical rand() function ? Which library do i need. or where could i find information about this?

Thanks

  • I found this note, it helped me to understand random generation through the linear congruential method. :P

    http://www.ti.com/lit/an/spra239/spra239.pdf

  • Thanks for posting this.  I am sure other forum users will find it helpful.  

    If you need something faster, but not quite as random, you can use a LFSR (linear feedback shift register).  Wikipedia has some C code that ports pretty much directly to the DSP.

    If you need something more truly random (but much slower), you can sample a noisy signal with the ADC and take the lower order bits.  This could be a way to seed your random number generator too.