I am trying to use the randomize function but I don't seem to have the random.h library. I am using Visual Studio 6.0. Can someone tell me where I could download this library so I can utilize this function.
TIA
This is a discussion on Random.h within the C++ Programming forums, part of the General Programming Boards category; I am trying to use the randomize function but I don't seem to have the random.h library. I am using ...
I am trying to use the randomize function but I don't seem to have the random.h library. I am using Visual Studio 6.0. Can someone tell me where I could download this library so I can utilize this function.
TIA
I wasn't aware there was a random.h header file. This should work fine:
Code:#include<time.h> #include<iostream> using namespace std; int main() { srand(time(NULL)); int x=rand()%100; // random number from 0-99 cout<<x<<endl; return 0; }
The ANSI rand() and srand() are in
#include <cstdlib>
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Err...there's boost/random.hpp under the boost library?
Is that what you are after?