"static namespace reference" scripting error

I just updated Xojo from 2014r1.1 to 2016r1.1. When I run my code:

if Random() < 0 then
    // do something
else
    // do something
end if

I get the following error message:

What does that mean and how do I resolve it? What has changed in Xojo in the past two years to cause this error? (Previously, my code worked fine.)

Random is a class name in the Xojo framework
Have you got a method with the same name ?

Random is a class in Xojo and attempting to use it like this would generate that error. If you had a method also called Random then your code ought to work, but if the method is not in scope, then it would try to use the built-in Random class and give this error.

The error message is pedantically correct, though not incredibly helpful. As others have mentioned, the ‘Random’ identifier in that context resolves to the Random class and not your Random function.

Name lookup changed in 2014r3 to obey a consistent set of rules (which were the documented rules). If you analyze your project, the compiler will tell you that the name lookup for Random changed, what it used to resolve to, and what it now resolves to.