<selectPrimeNumbers/>
<selectPrimeNumbers/>
is a Math
component that selects a prime number at random from a specified range. Selections generate variants of the document.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
asList = "…" | "true" "false" | |
exclude = "…" | numberList | |
excludeCombinations = "…" | ||
maxValue = "…" | integer | |
minValue = "…" | integer | |
numToSelect = "…" | integer | |
sortResults = "…" | boolean | "true" "false" |
withReplacement = "…" | boolean | "true" "false" |
Property | Type |
---|---|
$s.exclude | numberList |
$s.maxValue | integer |
$s.minValue | integer |
$s.numToSelect | integer |
$s.sortResults | boolean |
$s.withReplacement | boolean |
Example: Default <selectPrimeNumbers/>
The default <selectPrimeNumbers/>
has a sequence range from to .
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Example: Generate multiple selections
Three numbers that are selected between and . Individual selections can be accessed using array notation.
Example: Assigning descriptive names to multiple selections
The numToSelect
attribute allows for selection of multiple values within the range of a single <selectPrimeNumbers/>
component. Multiple selections are made without replacement. Selections can be assigned more descriptive names by defining individual components
which reference the selected values.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: sortResults
The sortResults
attribute sorts the selected results in increasing order.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Example: minValue, maxValue
The minValue
and maxValue
attributes specify the endpoints of the selection interval. These endpoints are not required to be prime numbers.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: exclude
The exclude
attribute specifies values to exclude in the selection.
Doenet will throw an error if sufficient primes are not available in the selection interval without
replacement. If repetitions are allowed, the withReplacement
attribute can be used.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Attribute Example: withReplacement
If selection with replacement is the desired behavior, use the withReplacement
attribute.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.
Example: excludeCombinations
The excludeCombinations
attribute can be used to exclude undesired combinations of prime numbers.
Select a new page variant from the pulldown menu at the top of the editor to see different variants of the document.