This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Rand function Method

I would like to know on which method Keil rand() function generates the random values.Are they using LCM or Linear Feedback shift register or any other method?

Please help me in this.

Thanks
Gopi

Parents
  • The sequence of numbers produced by an algorithm (especially the common ones like LCG and LFSR) have some statistical correlation. They all involve state that ties them to previous results.

    The button press / timer is a reasonable way to get a seed for most purposes. But, as I said, if you're really concerned about producing an uncorrelated stream of numbers, you'll need some hardware support. There are relatively few applications that need to obsess over the randomness of their numbers in this detail, though. Do you really need to go to this much trouble (http://www.fourmilab.ch/hotbits/)? Well, maybe if you're doing cryptography, or generating lotto numbers, or doing some heavy duty Monte Carlo simulation.

    A nice summary of the topic:
    http://www.faqs.org/rfcs/rfc1750.html

Reply
  • The sequence of numbers produced by an algorithm (especially the common ones like LCG and LFSR) have some statistical correlation. They all involve state that ties them to previous results.

    The button press / timer is a reasonable way to get a seed for most purposes. But, as I said, if you're really concerned about producing an uncorrelated stream of numbers, you'll need some hardware support. There are relatively few applications that need to obsess over the randomness of their numbers in this detail, though. Do you really need to go to this much trouble (http://www.fourmilab.ch/hotbits/)? Well, maybe if you're doing cryptography, or generating lotto numbers, or doing some heavy duty Monte Carlo simulation.

    A nice summary of the topic:
    http://www.faqs.org/rfcs/rfc1750.html

Children
No data