I'm trying to create an infinite loop that makes a variable increment from 0 to max 30 and min 3 taking one second between each increment. But instead of this it doesn't increment at all, instead it starts logging check over and over again and the variables x and random never get redefined.

```
var random = Math.floor(Math.random() * 27) + 3;
var x = 0;

setInterval(count, 1000)

function count() {
    if (x < random) {
        x++document.getElementById("secs").innerHTML = x + "s ago";

        console.log(x);
        console.log(random);

    } else {
        var random = Math.floor(Math.random() * 27) + 3;
        var x = 0;
        console.log("check")

    }
};

```