The Randnum Function
2 posters
CMPC :: Computing :: Programming :: C++
Page 1 of 1
The Randnum Function
I just added this to my DevC++ library yesterday seeing as how often i use it.
here you go.
here you go.
- Code:
#ifndef _RANDNUM_H_
#define _RANDNUM_H_
#include <ctime>
#include <cstdlib>
using namespace std;
int randnum(int lownum, int highnum)
{
srand((unsigned)time(0));
return (rand()%(highnum+1)+lownum);
}
#endif
Admin- Pirate King
- Posts : 559
CMPC :: Computing :: Programming :: C++
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|