Difference between revisions of "RandomBetween Command"

From GeoGebra Manual
Jump to: navigation, search
m (Text replace - "<div class="box info"> 48px|left This page is part of the official manual for print and pdf. For structural reasons normal users can't edit this page. If you found any errors on this page please contact )
m (typo)
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.2}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|probability}}
{{command|cas=true|probability}}
+
; RandomBetween( <Minimum Integer> , <Maximum Integer> ): Generates a random integer between ''minimum'' and ''maximum'' (inclusive).
; RandomBetween[ <Minimum Integer> , <Maximum Integer> ]: Generates a random integer between ''min'' and ''max'' (inclusive).
+
:{{example| 1=<code><nowiki>RandomBetween(0, 10)</nowiki></code> yields a number between ''0'' and ''10'' (inclusive)}}
{{example| 1=<div><code><nowiki>RandomBetween[0, 10]</nowiki></code> yields a number between 0 and 10 (inclusive)</div>}}
+
;RandomBetween( <Minimum Integer> , <Maximum Integer> , <Boolean Fixed> )
 
+
: If ''Boolean Fixed'' = "true", it generates a random integer between ''minimum'' and ''maximum'' (inclusive), which is updated just once (when file is loaded and also on undo/redo).
 +
:{{example| 1=<code><nowiki>RandomBetween(0, 10, true)</nowiki></code> yields a number between ''0'' and ''10'' (inclusive)}}
 +
{{note|1=Press {{KeyCode|F9}} to see the difference between those two syntaxes.}}
 +
;RandomBetween( <Minimum Integer> , <Maximum Integer>, <Number of Samples> )
 +
:Generates a list of random integers between ''minimum'' and ''maximum'' (inclusive). The number of random integers in the list is the ''number of samples''.
 +
:{{example| 1=<code><nowiki>RandomBetween(0, 10, 5)</nowiki></code> yields {1,3,4,8,2}, or {7,5,6,1,7}, etc.}}
 
{{Note|1= See also [[SetSeed Command|SetSeed command]], [[RandomElement Command|RandomElement command]],  [[RandomBinomial Command|RandomBinomial command]], [[RandomNormal Command|RandomNormal command]], [[RandomPoisson Command|RandomPoisson command]], [[RandomUniform Command|RandomUniform command]].}}
 
{{Note|1= See also [[SetSeed Command|SetSeed command]], [[RandomElement Command|RandomElement command]],  [[RandomBinomial Command|RandomBinomial command]], [[RandomNormal Command|RandomNormal command]], [[RandomPoisson Command|RandomPoisson command]], [[RandomUniform Command|RandomUniform command]].}}
 
;RandomBetween[ <Minimum Integer> , <Maximum Integer> , <Boolean Fixed> ]
 
: If <Boolean Fixed> = "true", it generates a random integer between ''min'' and ''max'' (inclusive), which is updated just once (when file is loaded and also on undo/redo).
 
{{note|1=Press {{KeyCode|F9}} to see the difference between those two syntaxes.}}
 
 
==CAS Syntax==
 
; RandomBetween[ <Minimum Integer> , <Maximum Integer> ]: Generates a random integer between ''min'' and ''max'' (inclusive).
 
{{example| 1=<div><code><nowiki>RandomBetween[0, 10]</nowiki></code> yields a number between 0 and 10 (inclusive)</div>}}
 

Latest revision as of 09:58, 11 December 2023


RandomBetween( <Minimum Integer> , <Maximum Integer> )
Generates a random integer between minimum and maximum (inclusive).
Example: RandomBetween(0, 10) yields a number between 0 and 10 (inclusive)
RandomBetween( <Minimum Integer> , <Maximum Integer> , <Boolean Fixed> )
If Boolean Fixed = "true", it generates a random integer between minimum and maximum (inclusive), which is updated just once (when file is loaded and also on undo/redo).
Example: RandomBetween(0, 10, true) yields a number between 0 and 10 (inclusive)
Note: Press F9 to see the difference between those two syntaxes.
RandomBetween( <Minimum Integer> , <Maximum Integer>, <Number of Samples> )
Generates a list of random integers between minimum and maximum (inclusive). The number of random integers in the list is the number of samples.
Example: RandomBetween(0, 10, 5) yields {1,3,4,8,2}, or {7,5,6,1,7}, etc.
© 2024 International GeoGebra Institute