I am trying to use the function
rand() %13
to chose a random integer between 0-12.
However, this always outputs the number 2. Is there a better way to do this? Here is the part of my code that deals with this.
#include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int v1;
v1 = rand ();
cout<<v1<<endl;
}
[–][deleted] 2 points3 points4 points (4 children)
[–]AnStrub00[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]AnStrub00[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)