I have a function like such
And i use it as followdCode:#include <cstdlib> inline int randInt(int limit) { return limit <= 1 ? 0 : (rand() % limit); }
And my lastTemp.c and latTemp.r are both = 0;Code:if(randInt(2) == 1) { column = ((randInt(2) == 1) ? (lastTemp.c + randInt(4)) : (lastTemp.c - randInt(4))); row = lastTemp.r; } else { column = lastTemp.c; row = ((randInt(2) == 1) ? (lastTemp.r + randInt(4)) : (lastTemp.r - randInt(4))); }
I get the same sequence every time. which is
r - c
0 - 0
0 - 3
1 - 0
2 - 1
0 - 2
3 - 0
how come i dont get 2 - 0 ?




Reply With Quote