The German lottery currently holds a jackpot of about 30 million Euro. A friend of mine took the bait and participated yesterday. Since he is a software developer, he wrote a small program to get him six random numbers in the range of 1 and 49.
Well, it's not difficult to write such a programm. The challenge is to do so in little bytes. So I challenge you:
Write a JavaScript function that generates random lotto numbers. This function has to return an array of six different numbers from 1 to 49 (including both) in ascending order. You may use features of ECMA-262 only, that means no Array.contains and stuff. You must not induce global variables.
The function has to look like this
var getRandomLottoNumbers = function () {
// your implementation here
};
Read more