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

dice

i m trying to make a dice!! displaying the numbers in LCD and the dice with the help of 7 lEDs in MIDE-51 with C programming codes. I can't create a random no.
How to generate a random no. in C language.

i used rand() but it gave only one fixed no.

plz help

  • Note that "dice" is plural - one of them is a die

    "How to generate a random no. in C language"

    You can't! The best you can do is pseudo-random - put that term into the 'Search' box (and/or google) to find the many other posts on this topic!

    "i used rand() but it gave only one fixed no"

    Also google "seed"...

  • How to generate a random no. in C language.

    I guess you have a button "roll the die"
    have a timer free running and when the button is pressed read it. That will be random

    Erik