Question: How to generate random integers x < y?

How to random generate 2 integer number with condition x must be less than y ?

I had tried the coding below. But the output shown not what i want.

x:=RandomTools[Generate](integer(range=1..7);

y:=RandomTools[Generate](integer(range=1..7);

if x>= y then x:=RandomTools[Generate](integer(range=1..7); y:=RandomTools[Generate](integer(range=1..7); end if;

 

Example:

I get x:= 5 , y:=1, then i need to regenerate the value of x and y using the last statemet above. but the problem is sometime i might still get the value of x>= y for example on second generate x:3, y=2. I need a code that x and y must be regerate until it get x<y. Can someone help ? Thank you in advance.

 

Please Wait...