I am trying to create a game for fun in Captivate. The game will mimic a wheel of fortune or spin the wheel format.
I am trying to put a different spin on it, and not have any repeating numbers.
Here is what I have so far:
function getRandomInt (min, max) {
var jsRandomNumber = Math.floor (Math.random () * (max - min + 1)) + min;
if(jsRandomNumber==1){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 1);
}else if (jsRandomNumber==2){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 2);
}else if (jsRandomNumber==3){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 3);
}else if (jsRandomNumber==4){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 4);
}else if (jsRandomNumber==5){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 5);
}else if (jsRandomNumber==6){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 6);
}else if (jsRandomNumber==7){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 7);
}else if (jsRandomNumber==8){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 8);
}
}
getRandomInt(1,8);
I don't understand how to prevent repetitive numbers. I also can assign values in Captivate if a slide has been viewed, however I don't understand how to skip that slide if the random number is generated. Any help is greatly appreciated.