Random number code

This is a discussion on Random number code within the C Programming forums, part of the General Programming Boards category; whats the define code for random number??? i know how to use > rand()% 35 + 1; but wads the ...

  1. #1
    Registered User l2krence's Avatar
    Join Date
    Nov 2010
    Posts
    24

    Random number code

    whats the define code for random number???
    i know how to use > rand()% 35 + 1;

    but wads the define code? i forgot!
    something like
    srand(unsigned (NULL))??

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,641
    Read Prelude's article on using rand()
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. random number guessing game
    By kazoo in forum C Programming
    Replies: 7
    Last Post: 05-30-2010, 11:31 AM
  2. rapid random number generation problem
    By Newton in forum C Programming
    Replies: 17
    Last Post: 09-19-2008, 02:08 PM
  3. Code for random number generator???
    By mero24 in forum C++ Programming
    Replies: 5
    Last Post: 05-02-2005, 03:15 AM
  4. Counting number from a random file
    By kamisama in forum C Programming
    Replies: 42
    Last Post: 02-22-2005, 04:16 PM
  5. Replies: 25
    Last Post: 10-28-2001, 12:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21