DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Random Integers?

  1. #1
    Hickaru Guest

    Random Integers?


    Who do you get CPP to give you one?
    Doesn't it have something to do with time.h?

  2. #2
    Matthew Needham Guest

    Re: Random Integers?


    "Hickaru" <hickaru@netzero.net> wrote:
    >
    >Who do you get CPP to give you one?
    >Doesn't it have something to do with time.h?


    Use the rand() function. Contained in stdlib.h

    Quite often u also include time.h as the random number generator has to be
    seeded and an easy way to do this is with the time, eg

    srand( (unsigned)time( NULL ) );

    hope that helps,

    Matt


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center