random odd numeber generator

1
2
3
4
5
6
7
8
9
10
void render()
{
	int N;
	srand (time(NULL));
	N = rand() % 10 + 1;
	glClear(GL_COLOR_BUFFER_BIT);
	glViewport(10, 10, 640, 480);
	rosette(N, .66f);
	glFlush();
}


this is opengl using c++. I would like to set my random number generator to only generate odd numbers and set that number to N. I got the rand formula to work but i just cant figure out the "odd" part
Last edited on
if (N % 2 == 0) //num is even
Topic archived. No new replies allowed.