As far as I’m aware, math.random only supports integers (unless you pass no arguments, but that is just for 0-1). Instead, you could use the NextNumber method of a Random object returned by Random.new.
-- Assuming you have a parent object, such as a Frame
local parent = script.Parent -- Change this to your actual parent object
local randomX = math.random() -- Generates a random number between 0 and 1
local randomY = math.random()
-- Set the position
text.Position = UDim2.new(randomX, 0, randomY, 0)