DaveC426913
Programmer
Rusty on JavaScript.
I have a list of 14 text strings of which I want to randomly pick 6 unique ones.
for (i=1;i<=6;i++){
tmp = Math.round(Math.random()*14)+1;
for (j=1;j<i;j++){
if (tmp == col[j]){
i++;
}
}
col=tmp;
}
I've got it wrong: if it fails uniqueness, I don't want to increment i, I just want it to try another random #.
I have a list of 14 text strings of which I want to randomly pick 6 unique ones.
for (i=1;i<=6;i++){
tmp = Math.round(Math.random()*14)+1;
for (j=1;j<i;j++){
if (tmp == col[j]){
i++;
}
}
col=tmp;
}
I've got it wrong: if it fails uniqueness, I don't want to increment i, I just want it to try another random #.