I live in an area where quite a number of people play and make good winnings through BABA IJEBU LOTTO. I often have some idle 100 naira lying around somewhere on my desk so I decided to try my luck on this. But what do I know about the game and guessing likely wins or numbers, I decided to ask around and got a few concepts but then who has time to forecast numbers huh? I wrote a JS function to automate number guessing and permutating it for me. I hope to convert this into a mobile app soon when I have the time. Let me know your thoughts

Code show below:

//guess numbers to play

function guessnumbers() {

var arr = []

while(arr.length < 4) {

var randomnumber = Math.ceil(Math.random()*100)

if(arr.indexOf(randomnumber) > -1) continue;

arr[arr.length] = randomnumber;

}

return arr;

}

//permutation

function permute(input) {

var permArr = [],

usedChars = [];

return (function main() {

for (var i = 0; i < input.length; i++) {

var ch = input.splice(i, 1)[0];

usedChars.push(ch);

if (input.length == 0) {

permArr.push(usedChars.slice());

}

main();

input.splice(i, 0, ch);

usedChars.pop();

}

return permArr;

})();

}

//baba ijebu example of permutation

var guessednumbers = guessnumbers();

var permed = permute(guessednumbers);

document.write(“

Baba ijebu guess: " + guessednumbers);

document.write(”

Permutation of **" + guessednumbers + "** is " + permed);