Running the following example throws exception "Error in expression for node: ZExpression Cannot get address of expression: ((vec3)CurrentModel.Position". Everything is running fine if instead of CurrentModel.Position a vec3 variable (called ObjectPosition in this case) is used. Direct usage of CurrentModel.* vec3 properties as reference vec3 parameters in functions would be useful.
Remark: When writing the Model1/OnSpawn/ZExpression to editor, no syntax error is reported. Only when running the project or copy/pasting to XML editor.
Although i suspect the snippet you posted was just a example illustrating the bug .. the following expression gives the exact same result as your randMax function with 3 separate random calls.
Sure, I always try to illustrate problems on small examples to be easy reproduced by people (mainly Ville). I would like to use this feature in much bigger project(s) to create effective/small code. But writing "pos = random(0, max);" would make it better having the same functionality.