> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/math/randrange.md).

# 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`   | The lower bound of the range.                       |         |
| `number2`   | `numeric` | `true`   | The upper bound of the range.                       |         |
| `algorithm` | `string`  | `false`  | The algorithm to use to generate the random number. |         |

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
