CODE
#include <windows.h>
#include <GL/glut.h>
#include "tgaload.h"
int random(int );
/* Define ball class for animation values */
class BallClass {
public:
float inc;
float yposo,vyo,ypos,times,ay;
float xposo,vxo,xpos,ax;
float rotate;
BallClass () {
rotate=5;
inc=.02;
yposo=2,vyo=0,ypos=2,times=0,ay=-9.8;
xposo=-2,vxo=random(20)+1,xpos=2,ax=0;
}
};
/* Create an array of type BallClass that may hold 500 balls */
BallClass ball[500];
int ballnum=0;
int totalball=5;
double d=0; // used in rotation
float zoom = -7;
image_t fire_image;
void init ( void )
{
tgaGetColorEXT();
glColorMaterial ( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );
glEnable ( GL_TEXTURE_2D );
glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
glGenTextures ( 1, 0 );
glBindTexture ( GL_TEXTURE_2D, 0 );
tgaLoadImage ( "fire.tga", &fire_image, TGA_FREE );
glEnable ( GL_CULL_FACE );
glClearColor ( 0, 0.0, 1.0, 0.0 );
glTranslatef ( 0.0, 0.0, zoom );
}
void display(void)
{
for (ballnum=0;ballnum < totalball; ballnum++) {
d+=0.4;
glPushMatrix ( );
glBindTexture ( GL_TEXTURE_2D, 0 );
GLUquadricObj* q = gluNewQuadric ( );
gluQuadricDrawStyle ( q, GLU_FILL );
gluQuadricNormals ( q, GLU_SMOOTH );
gluQuadricTexture ( q, GL_TRUE );
glTranslated ( ball[ballnum].xpos, ball[ballnum].ypos, -11.0 );
glRotated(ball[ballnum].rotate,1,1,1);
gluSphere ( q, .3, 20, 20 );
gluDeleteQuadric ( q );
glPopMatrix ( );
}
glEnable ( GL_BLEND );
glPopMatrix ( );
glutSwapBuffers ( );
glClear ( GL_COLOR_BUFFER_BIT );
}
void reshape(int w, int h)
{
glViewport(0, 0, (GLint) w, (GLint) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if ( h==0)
gluPerspective(45, (GLdouble)w, 1.0, 100.0);
else
gluPerspective(45, (GLdouble)w/(GLdouble)h,1.0, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
void idle_func (void)
{
for (ballnum=0;ballnum < totalball; ballnum++) {
ball[ballnum].rotate+=((rand()%10));
ball[ballnum].times+=ball[ballnum].inc;
ball[ballnum].ypos=ball[ballnum].yposo + (ball[ballnum].vyo*ball[ballnum].times) + (.5*ball[ballnum].ay*
(ball[ballnum].times*ball[ballnum].times));
ball[ballnum].xpos=ball[ballnum].xposo + (ball[ballnum].vxo*ball[ballnum].times)
+ (.5*ball[ballnum].ax*(ball[ballnum].times*ball[ballnum].times));
if ((ball[ballnum].ypos < -4.2)) {
ball[ballnum].vyo=random(15);
ball[ballnum].times=0;
ball[ballnum].yposo=ball[ballnum].ypos;
ball[ballnum].xposo=ball[ballnum].xpos;
}
else if ((ball[ballnum].ypos > 4.2)) {
ball[ballnum].ay=1*ball[ballnum].ay;ball[ballnum].vyo=-1
*random(10);ball[ballnum].times=0;
ball[ballnum].yposo=ball[ballnum].ypos;
ball[ballnum].xposo=ball[ballnum].xpos;
}
else if ((ball[ballnum].xpos > 5.5)) {
ball[ballnum].vxo=-1-random(20);ball[ballnum].times=0;
ball[ballnum].xposo=ball[ballnum].xpos;ball[ballnum].yposo=ball[ballnum].ypos;
}
else if ((ball[ballnum].xpos < -5.5)) {
ball[ballnum].vxo=random(20);ball[ballnum].times=0;
ball[ballnum].xposo=ball[ballnum].xpos;ball[ballnum].yposo=ball[ballnum].ypos;
}
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutInitWindowSize (800, 600);
glutCreateWindow (argv[0]);
init();
glutReshapeFunc (reshape);
glutDisplayFunc (display);
glutIdleFunc (idle_func);
glutMainLoop();
return 0;
}
WHENEVER I EXECUTE THE ABOVE CODE,I GET 5 ERRORS SAYING RANDOM IDENTIFIER NOT DEFINED. WHAT SHOULD I DO?

Mod Edit: Please use code tags when posting your code. Code tags are used like so =>

Thanks,
PsychoCoder