Affichage des images aléatoire avec js

<!DOCTYPE html>
<html>
<head>
  <title>RÉCUPÉRER LE NOM DU FICHIER DEPUIS INPUT FILE | par NGLESSON </title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="author" content="Mezgani said">
  <meta name="copyright" content="NGLESSON">
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
  <link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
  <div class="container">
    <div class="row mx-auto text-centermt-5">
      <div class="col-lg-4 col-12">
        <img src="https://www.nglesson.com/assets/imgs/menu/integration-web.jpg" class="img-fluid" id="attach" alt="attach" title="attach">
      </div>
    </div>
  </div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="script.js"></script>
</body>
</html>
.custom-attach-upload {
    border: 1px solid #999;
    display: inline-block;
    padding: 12px 12px;
    cursor: pointer;
    background: #ccc;
}
.custom-attach-upload:hover {
    background: #FFF;
}
//window.onload = randomImg;

window.onload = function() {
    randomImg();
};

var myFile = new Array("https://www.nglesson.com/assets/imgs/menu/solution-technique.jpg",
"https://www.nglesson.com/assets/imgs/menu/problematique.jpg",
"https://www.nglesson.com/assets/imgs/menu/cours-web.jpg");

function randomImg() {
     var randomNum = Math.floor(Math.random() * myFile.length);
     document.getElementById("attach").src = myFile[randomNum];
}
Timeline style01

Timeline style01

Profile page with b4

Profile page with b4

Planète animée style01

Planète animée style01

Pie Charts

Pie Charts

Lightbox gallery style01

Lightbox gallery style01

Input file style01

Input file style01

Image hover 05

Image hover 05

Card Profile Style01

Card Profile Style01

Bloc resizable with jquery

Bloc resizable with jquery

Alert Bootstrap4 style02

Alert Bootstrap4 style02

Ajouter supprimer une tr dans une table

Ajouter supprimer une tr dans une table

Ajouter supprimer dynamiquement des lignes sur un tableau

Ajouter supprimer dynamiquement des lignes sur un tableau