Yes, that works. But,
cls will also clear anything else from the screen, making you to have to repaste everything again, which can take up precious processor time.
So, an alternative to cls(which this alternative in not always useful) is to clear the text by changing the ink color to the background color and then repasting the text in the same place. This will 'clear' the text from the screen without having to clear the whole screen.
Ex:
global x as integer
global y as integer
x=rnd(screen width())
y=rnd(screen height())
time=timer()
repeat
if timer()-time>1000
moveandprinttext("Here is some text")
time=timer()
endif
until spacekey()
end
function moveandprinttext(msg$)
ink rgb(0,0,0)
center text x,y,msg$
x=rnd(screen width())
y=rnd(screen height())
ink rgb(255,255,255)
center text x,y,msg$
endfunction