The randInt( Command

Command Summary

Generates a random integer between min and max, inclusive, or a list of such numbers.

Command Syntax

randInt(min,max[,# of numbers])

Menu Location


  1. MATH to access the math menu.
  2. LEFT to access the PRB submenu.
  3. 5 to select randInt(, or use arrows.

Calculator Compatibility


Token Size

2 bytes

randInt(min,max) generates a uniformly-distributed pseudorandom integer between min and max inclusive. randInt(min,max,n) generates a list of n uniformly-distributed pseudorandom integers between min and max.

seed→rand affects the output of randInt(.

     {10 2 6 5 8}


When the lower bound of randInt( is 0, you can replace it with int(#rand to save space. For example:

can be

Similarly, if you don't want to include zero in the range, you can use a variant of 1-#int(#rand:


In this particular example, the only values that you will ever get are -1 or 1.


The value of randInt( for a given seed can be expressed in terms of rand:


  • when A<B, A+int((B-A+1)rand
  • otherwise, B+int((A-B+1)rand

This is identical to the output of randInt( in the sense that for the same seed, both expressions will generate the same random numbers.

Error Conditions

  • ERR:DOMAIN is thrown if any of the arguments is a decimal.
  • ERR: DATA TYPE is given if you use imaginary numbers like 6i or something like Matrices or Lists. This error is used instead of ERR:DOMAIN for "i".

Related Commands


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.