JSFiddle - React, Tailwind, and code Playground

by Tintu Raju

JavaScript

function shuffle(array) {
  var currentIndex = array.length, temporaryValue, randomIndex;

  // While there remain elements to shuffle...
  while (0 !== currentIndex) {

    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex -= 1;

    // And swap it with the current element.
    temporaryValue = array[currentIndex];
    array[currentIndex] = array[randomIndex];
    array[randomIndex] = temporaryValue;
  }

  return array;
}


friends = [

 "aby",
 "abey",
 "shyam",
 "subin",
 "vinayak",
 "Deepak",
 "rahul",
 "tintu",
 "amerish",
 "anuraj",
 "jayaram",
 "jayaraj",
 "rajeev",
 "sooraj",
 "Seliesh",
 "joyal",
 "abin",
 "Athira raj",
 "Athira vipin",
 "sherin",
 "sonamol",
 "neethu vijayan",
 "neethu das",
 "diya",
 "swetha",
 "sruthy",
 "soumya",
 "joshly",
 "sarayu",
 "vandana",
 "samitha",
 "abini",
 "aneesha",
 "renuka",
 "preethy",
 "bincy"]
 
 friends = shuffle(friends);
 
 for(i=0;i<30;++i)
 var friend = friends[Math.floor(Math.random()*friends.length)];
 
 alert( "Your friends prediction : " + friend)