Posición de imagen aleatoria en React

import React, { useRef } from 'react';
    
const Image = () => {
   const ChipStyles = useRef({
       position: 'absolute',
       top: Math.floor(Math.random()*50),
       left: '50%',
       transform: 'translate(-50%, -50%)'
   });

   return (
     <img src={myImg} style={ChipStyles.current} alt=""}/>
   )
}
    
export default Image
McKovalski