Not exactly sure what "lock" is supposed to do, but check out how random() function works in Construct manual -> scirra.com/manual/126/system-expressions
random(a, b)
Generate a random float between a and b, including a but not including b.
You see, random() returns a float (decimal number), and you are trying to compare it with an integer (whole number). Try wrapping random() in an int() like this -> int(random(1,3)).
int(x)
Convert the float or text x to an integer (whole number).
Just as a general advice, create a text object for testing, and if unsure, set text to your random(1,3), just to check out the result.
Good luck!