News for hackers. Stuff that matters.
Re:South Africa's lottery probed as 5, 6, 7, 8, 9 and 10 drawn by ALittleLight on Wednesday December 02, 2020 @07:32PM (#25283761)
Unless I'm doing something wrong here - just typing some javascript into the console gives me...

  function rn() {
      return parseInt(Math.random() * 100);
  }


  function drawing(){
      let result = [rn(), rn(), rn(), rn(), rn()]; 
      return result.sort();
  };


  function sequential(arr){
      for(let i = 0; i < arr.length-1; i++){
          if(arr[i] + 1 != arr[i+1]){
              return false
          } 
      } 
      return true
  }

  let counter = 0; 

  for (let i = 0; i < 10000000; i ++){
      if (sequential(drawing())){
          counter ++;
      } 
  }; 

  console.log(counter);

  16
Mathematically, it seems like you'd need to draw one of five numbers from the range, then one of four numbers, then one of three... so the likelihood would be 5/100 * 4/100 * 3/100 * 2/100 * 1/100 = 0.000000012. Although those odds don't seem to line up with the javascript I posted.

There are no comments on this comment yet.