08-23-2001, 09:20 AM
ok I am doing little random coloring on c++/opengl...
But I got little problem when I use rand()...
so I made little program...
But after compile and running it several times I always get same numbers...
I know this is not opengl problem but this is the best coding forum...
#include <iostream.h>
int a,b,c;
float d,e,f;
void main(void)
{
f=3.2f;
a=(int)rand();
b=5+rand()%6;
c=(int)rand();
d=(float)rand()/3;
e=4*rand()%3;
//f=rand();
cout << rand() <<endl;
cout << b <<endl;
cout << c <<endl;
cout << d <<endl;
cout << e <<endl;
cout << f <<endl;
}
But I got little problem when I use rand()...
so I made little program...
But after compile and running it several times I always get same numbers...
I know this is not opengl problem but this is the best coding forum...
#include <iostream.h>
int a,b,c;
float d,e,f;
void main(void)
{
f=3.2f;
a=(int)rand();
b=5+rand()%6;
c=(int)rand();
d=(float)rand()/3;
e=4*rand()%3;
//f=rand();
cout << rand() <<endl;
cout << b <<endl;
cout << c <<endl;
cout << d <<endl;
cout << e <<endl;
cout << f <<endl;
}