As the title suggests, I’m trying to find a number that is in between two other integers, not just halfway, but any number between two set integers.

This question is too broad.

- Do you want to generate a pseudo-random number in between 2 endpoints?
- Use
`math.random(min, max)`

.

- Use
- Do you want to test if a number is within 2 endpoints?
- You can confirm this if
`num >= min and num <= max`

.

- You can confirm this if

How are you planning on “finding” such number?

I think the second choice is my answer.

My plan is to change the Text property of a TextLabel when the integer is found.

So when the Value on the left screen is a certain temperature, the stability on the right screen changes. I’ve spoken about this on the DevForum Discord server.

Any plans on elaborating on this? What certain numbers are you looking to work with? min, max? Randomly generate a number with a min and max, and then confirm if it’s within range by using Incapaz second method?

You can actually just use basic maths and do;

```
local number1 = 50
local number2 = 1
print((number1 + number2)/2) -- add two numbers and half to find the middle
> 25.5
```

I think you’ll be looking for something like:

```
local max = 3500
local min = 600
if number > min and number < max then
unstable = false
else
unstable = true
end
```

Baring in mind that this check will have to run whenever the number changes if you want something to happen as soon as the number is out of the critical range.

I know how to half numbers, read my post.

Can’t you just do, `math.random(number1, number2)`

, it will give you a random number between those two.

Or if you’re trying to check if a number is between those two numbers, then use some conditional logic.

I need the numbers to be adjacent to each other, so if it’s at 502, it won’t suddenly go down to 23 or something like that.

Subtract the lower number from the higher number to determine how many numbers are between them. Add it to the lower number for the exact intermediate numbers.

Alternatively use `math.clamp`

.

What does `math.clamp`

do in regards to my situation?

It’ll keep a number constrained between two other numbers.