ReferencesamplePrimeNumbers

<samplePrimeNumbers/>

Samples random prime numbers

<samplePrimeNumbers/> is a Math component that samples random prime numbers from a specified range of values.

Attributes and Properties

Attributes for <samplePrimeNumbers>

Other (6)
asList

boolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).

numberList. Primes to exclude from the sample.

integer. Default value: 2. Lower bound (inclusive) of the prime range to sample from.

number. Default value: 1. Number of prime samples to draw.

integer. Default value: 100. Upper bound (inclusive) of the prime range to sample from.

variantDeterminesSeed

boolean. Whether the document's variant index determines the random seed.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <samplePrimeNumbers name="s">

Other (5)
$s.exclude

numberList. Primes to exclude from the sample.

$s.from

integer. Lower bound (inclusive) of the prime range to sample from.

$s.numSamples

number. Number of prime samples to draw.

$s.to

integer. Upper bound (inclusive) of the prime range to sample from.

$s.variantDeterminesSeed

boolean. Whether the document's variant index determines the random seed.

Common to all components (4)
$s.doenetML

text. The DoenetML source code that produced this component.

$s.hide

boolean. Whether to hide this component from the rendered output.

$s.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$s.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Default <samplePrimeNumbers

Without any attributes specified, the default sampling range is [2,97][2, 97]. In this example, there are two ways to view different samples: selecting another variant, or refreshing the page.


Example: Using a re-sampling button

Without any attributes specified, the default sampling range is [2,97][2, 97]. The <callAction> button can be used to resample the value.

Attribute Examples

Attribute Example: numSamples

The <samplePrimeNumbers/> component is used with the numSamples attribute to select multiple random values in the default interval [2,97][2,97].


Attribute Example: from, to

The <samplePrimeNumbers/> component is used with the from and the to attributes to modify the default selection interval. Note that the interval endpoints provided do not need to be primes.


Attribute Example: exclude

Values can be excluded from the sampled range using the exclude attribute.