function moveRandomly() {
    var textElement = document.getElementById("p");
    var randomX = Math.floor(Math.random() * window.innerWidth);
    var randomY = Math.floor(Math.random() * window.innerHeight);
    textElement.style.transition = "left 0.5s, top 0.5s";
    textElement.style.left = randomX + "px";
    textElement.style.top = randomY + "px";
}

setInterval(moveRandomly, 500);
moveRandomly();
