# RandRange

Return a random int between number1 and number 2

## Method Signature

```
RandRange(number1=[numeric], number2=[numeric], algorithm=[string])
```

### Arguments

| Argument    | Type      | Required | Description | Default |
| ----------- | --------- | -------- | ----------- | ------- |
| `number1`   | `numeric` | `true`   |             |         |
| `number2`   | `numeric` | `true`   |             |         |
| `algorithm` | `string`  | `false`  |             |         |

## Examples

### Tag Example

The following example calls the Randomize function to seed the random number generator and generates 10 random numbers.

```java
<bx:set r = randomize( 7, "SHA1PRNG" ) > 
 <bx:set local.MYINT = 1 > 
 <bx:set local.MYINT2 = 999 > 
<!--- Generate and display the random number. ---> 
 <bx:output><p><b> 
 RandRange returned: #randRange( local.MYINT, local.MYINT2, "SHA1PRNG" )# 
 </bx:output></b></p>  
```

### Script Example

```java
<bx:script>
	bytes = [];
	bytecount = 32;
	arrayResize( bytes, byteCount );
	for( i = 1; i <= byteCount; i++ ) {
		bytes[ i ] = randRange( -128, 127, "SHA1PRNG" );
	}
</bx:script>
 
 <bx:dump var="#bytes#"/>  
```

### Additional Examples

```java
writeDump( randRange( 25, 125, "bxmX_COMPAT" ) );
writeDump( randRange( 100, 500, "SHA1PRNG" ) );

```

## Related

* [Abs](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/abs)
* [Acos](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/acos)
* [Asin](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/asin)
* [Atn](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/atn)
* [Ceiling](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/ceiling)
* [Cos](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/cos)
* [DecrementValue](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/decrementvalue)
* [Exp](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/exp)
* [Fix](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/fix)
* [Floor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/floor)
* [FormatBaseN](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/formatbasen)
* [IncrementValue](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/incrementvalue)
* [InputBaseN](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/inputbasen)
* [Int](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/int)
* [Log](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/log)
* [Log10](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/log10)
* [Max](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/max)
* [Min](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/min)
* [Pi](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/pi)
* [PrecisionEvaluate](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/precisionevaluate)
* [Rand](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/rand)
* [Randomize](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/randomize)
* [Round](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/round)
* [Sgn](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/sgn)
* [Sin](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/sin)
* [Sqr](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/sqr)
* [Tan](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/tan)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/randrange.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
