I need to made 9 divs in each div should be random number(1-9 but not repeatable)

Hello here I need to check the past z variable with a new one(z),please help

Hello here is what i got

<html>
    <head>
        <link rel = "stylesheet" href = "style.css">
    </head>
    <body onload = "myFunction()" id = "body">
        <div id = 'play_ground'>
        </div>
        <b2>PLAY<b2>
        <script src = "Game-9.js"></script>
    </body>
</html>
var play_box = document.getElementById('play_ground');
function myFunction(){
    for (i = 1; i <= 9; i++){
        var z = Math.floor(Math.random() * 10)
             play_box.innerHTML += '<div class = "box">'+ z +'</div>' };
        }
}

I just cant imagine how can i check the past z variable with a new one(z),please help