js中如何随机更改标签的top值(语言-javascript)

如题

问题相关代码
var n = document.getElementById('not');
n.onmouseover = function(){
        var top = Math.random()*200+100;
        var right = Math.random()*300+100;
        n.style.top = top;
        n.style.right = right;
}
我想要达到的结果

鼠标移动到id为not的按钮上时,随机更改top和right值
我现在可以做到更改为指定值,但是没有办法做到随机值

已经有4年没写过前端了,最近都在搞竞赛,希望各位不吝指教

是否解决了你说的问题?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,
        body {
            height: 100%;
            margin: 0;
        }
        #not {
            position: fixed;
            top: 0;
            left: 0;
            border: 0;
            background-color: aqua;
            width: 50px;
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
    </style>
</head>
<body>
    <button id="not">随机</button>

    <script>
        const btn = document.getElementById('not');
        const maxTop = document.body.clientHeight;
        const maxLeft = document.body.clientWidth;
        function getRandomPos() {
            const randomTop = Math.floor(Math.random() * (maxTop - 50));
            const randomLeft = Math.floor(Math.random() * (maxLeft - 30));

            return {
                randomLeft,
                randomTop
            }
        }

        btn.onmouseenter = () => {
            const { randomLeft, randomTop } = getRandomPos();

            btn.style.top = randomTop + 'px';
            btn.style.left = randomLeft + 'px';
        };
    </script>
</body>
</html>