# Random Integer

#### 12wwood

##### New Member
I need to generate two random integer, one with a range of 1 to 620 and another with a range of 1 to 420. I have no idea how I would go about doing this. Can someone give me a hand? Thanks.

#### Paul59

##### Active Member
CX Code Contributor
Type in 'Rnd' then making sure the cursor is within the word press F1. You'll find:

Function Rnd : Float ( range:Float )
and
Function Rnd : Float ( low:Float, high:Float )

You then need to convert the result to an integer using Int(n)

You could use either of these functions (add 1 to the result of the first version)

Have a go yourself, it's literally one line of code and it's better than someone just giving you the answer straight off

#### 12wwood

##### New Member
Type in 'Rnd' then making sure the cursor is within the word press F1. You'll find:

Function Rnd : Float ( range:Float )
and
Function Rnd : Float ( low:Float, high:Float )

You then need to convert the result to an integer using Int(n)

You could use either of these functions (add 1 to the result of the first version)

Have a go yourself, it's literally one line of code and it's better than someone just giving you the answer straight off
cheers mate, I literally just wasn't sure of what the command was and how you could use it but you basically gave me everything i needed to know. you're a legend.

#### 12wwood

##### New Member
cheers mate, I literally just wasn't sure of what the command was and how you could use it but you basically gave me everything i needed to know. you're a legend.
I am using monkey X and not Cerberus x, is this an issue?

#### Paul59

##### Active Member
CX Code Contributor
I am using monkey X and not Cerberus x, is this an issue?
You'll soon find out

#### MikeHart

I am using monkey X and not Cerberus x, is this an issue?
I don't think so. May i ask why you use MX?
Btw. Look into the Seed command too when you want to randomize numbers.

#### 12wwood

##### New Member
I don't think so. May i ask why you use MX?
Btw. Look into the Seed command too when you want to randomize numbers.
because it was recommended to me when doing my project. i have switched to cerberus x now though as i found that it could open my code created in MX.