<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ARandint</id>
	<title>TI-BASIC:Randint - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=TI-BASIC%3ARandint"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Randint&amp;action=history"/>
	<updated>2026-05-30T18:08:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=TI-BASIC:Randint&amp;diff=1101&amp;oldid=prev</id>
		<title>Maintenance script: Initial automated import</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=TI-BASIC:Randint&amp;diff=1101&amp;oldid=prev"/>
		<updated>2016-02-24T18:34:40Z</updated>

		<summary type="html">&lt;p&gt;Initial automated import&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Template:TI-BASIC:Command&lt;br /&gt;
|picture=RANDINT.GIF&lt;br /&gt;
|summary=Generates a random integer between &amp;#039;&amp;#039;min&amp;#039;&amp;#039; and &amp;#039;&amp;#039;max&amp;#039;&amp;#039;, inclusive, or a list of such numbers.&lt;br /&gt;
|syntax=randInt(&amp;#039;&amp;#039;min&amp;#039;&amp;#039;,&amp;#039;&amp;#039;max&amp;#039;&amp;#039;[,&amp;#039;&amp;#039;# of numbers&amp;#039;&amp;#039;])&lt;br /&gt;
|location=Press:&lt;br /&gt;
# MATH to access the [[TI-BASIC:Math|Math]] menu.&lt;br /&gt;
# LEFT to access the PRB submenu.&lt;br /&gt;
# 5 to select randInt(, or use arrows.&lt;br /&gt;
|compatibility=TI-83/84/+/SE&lt;br /&gt;
|size=2 bytes&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
randInt(&amp;#039;&amp;#039;min&amp;#039;&amp;#039;,&amp;#039;&amp;#039;max&amp;#039;&amp;#039;) generates a uniformly-distributed pseudorandom integer between &amp;#039;&amp;#039;min&amp;#039;&amp;#039; and &amp;#039;&amp;#039;max&amp;#039;&amp;#039; inclusive. randInt(&amp;#039;&amp;#039;min&amp;#039;&amp;#039;,&amp;#039;&amp;#039;max&amp;#039;&amp;#039;,&amp;#039;&amp;#039;n&amp;#039;&amp;#039;) generates a list of &amp;#039;&amp;#039;n&amp;#039;&amp;#039; uniformly-distributed pseudorandom integers between &amp;#039;&amp;#039;min&amp;#039;&amp;#039; and &amp;#039;&amp;#039;max&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;seed&amp;#039;&amp;#039;→rand affects the output of randInt(.&lt;br /&gt;
&lt;br /&gt;
 0→rand&lt;br /&gt;
      0&lt;br /&gt;
 randInt(1,10)&lt;br /&gt;
      10&lt;br /&gt;
 randInt(1,10,5)&lt;br /&gt;
      {10 2 6 5 8}&lt;br /&gt;
&lt;br /&gt;
= Optimization =&lt;br /&gt;
&lt;br /&gt;
When the lower bound of randInt( is 0, you can replace it with int(#rand to save space. For example:&lt;br /&gt;
&lt;br /&gt;
 :randInt(0,12&lt;br /&gt;
 can be&lt;br /&gt;
 :int(13rand&lt;br /&gt;
&lt;br /&gt;
Similarly, if you don&amp;#039;t want to include zero in the range, you can use a variant of 1-#int(#rand:&lt;br /&gt;
&lt;br /&gt;
 :1-2int(2rand&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this particular example, the only values that you will ever get are -1 or 1.&lt;br /&gt;
&lt;br /&gt;
= Formulas =&lt;br /&gt;
&lt;br /&gt;
The value of randInt( for a given seed can be expressed in terms of [[TI-BASIC:Rand|Rand]]:&lt;br /&gt;
&lt;br /&gt;
randInt(A,B)=&lt;br /&gt;
* when A&amp;lt;B, A+int((B-A+1)rand&lt;br /&gt;
* otherwise, B+int((A-B+1)rand &lt;br /&gt;
&lt;br /&gt;
This is identical to the output of randInt( in the sense that for the same seed, both expressions will generate the same random numbers.&lt;br /&gt;
&lt;br /&gt;
= Error Conditions =&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;[[TI-BASIC:Errors#domain|ERR:DOMAIN]]&amp;#039;&amp;#039;&amp;#039; is thrown if any of the arguments is a decimal.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;[[TI-BASIC:Errors#datatype|ERR: DATA TYPE]]&amp;#039;&amp;#039;&amp;#039; is given if you use imaginary numbers like 6i or something like Matrices or Lists. This error is used instead of ERR:DOMAIN for &amp;quot;i&amp;quot;.&lt;br /&gt;
= Related Commands =&lt;br /&gt;
&lt;br /&gt;
* [[TI-BASIC:Rand|Rand]]&lt;br /&gt;
* [[TI-BASIC:Randbin|RandBin(]]&lt;br /&gt;
* [[TI-BASIC:Randnorm|RandNorm(]]&lt;br /&gt;
* [[TI-BASIC:Randm|RandM(]]&lt;br /&gt;
* [[TI-BASIC:Randintnorep|RandIntNoRep(]][[Category:TI-BASIC]]&lt;br /&gt;
[[Category:TIBD]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>