Random number.

Discussion in 'C' started by Danny_501, Aug 28, 2010.

  1. Danny_501

    Danny_501 New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,

    I need to get a random number from the following:

    #define RAND(min,max) ((min)+(int)((double)(max-min+1)*rand()/(RAND_MAX+1.0)))
    but when I print it out it just prints the value of min.
    printf("%d", RAND(10000000,99999999));
    please help!
    thanks in advance.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice