i can't for the life of me figure out how to write

int num;

num = rand() %. ...

i need a range of 0 to 1
I want to store either zero or one to num. That is my goal. plz help
(i'm a noob obviously)

i can't for the life of me figure out how to write

int num;

num = rand() %. ...

i need a range of 0 to 1
I want to store either zero or one to num. That is my goal. plz help
(i'm a noob obviously)

#include <iostream>
#include <ctime> 
#include <cstdlib> 

using namespace std;

int main()

{

int hello = 0;

srand(time(0));

hello = 1 + rand() % 2;

cout << hello;

return 0;

}

Perhaps that may help. srand is similar to rand apart from it seeds it. The time in brackets tells the proram to take the current time of the system clock and produce a randomn event based on it. This program will print a 1 or a 2 depending.

I hope this helps you in the right direction

yea that should help, thank you very much
muchos gracias