Quote: "If I put "Random(x, y)" in a main do/loop cycle it works fine. But if I put it in a function, and I call the function inside the do/loop, it doesn't work."
I'd also guess that you haven't declared x and y as global variable, but without any sample code, or reply from you to confirm, it is hard to say for sure.
// Project: randomtest
// Created: 2016-03-07
// set window properties
SetWindowTitle( "randomtest" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
` comment out this next line to see the difference!
global x as integer : global y as integer
x=100
y=50
do
print(getrandom())
Sync()
loop
function getrandom()
result = random(x,y)
endfunction result