integer - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


RandomTools Flavor: integer

describe a flavor of a random integer

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

integer

integer(opt)

Parameters

opt

-

equation of the form range = value; specify options for the random integer

Description

• 

The flavor integer describes a random integer in a particular range.

  

To describe a flavor of a random integer, use either integer or integer(opt) (where opt is as described below) as the argument to RandomTools[Generate] or as part of a structured flavor.

• 

By default, the flavor integer describes a random integer in the range −499999999994..499999999994, inclusive.

• 

You can modify the properties of the random integer by using the integer(opt) form of this flavor. The opt argument can contain one or more of the following equations.

  

 

  

range = a..b

  

This option specifies the range from which the random integer is chosen.

  

The endpoints must be of type integer and they describe a random integer in the interval a..b, inclusive.

  

If the left-hand endpoint of the range is greater than the right-hand endpoint, an exception is raised.

  

exclude= {n1,n2,...}

  

This option specifies one or more individual integers that should be excluded from the possible return values.  

Examples

> 

with⁡RandomTools:

> 

Generate⁡integer

−104281139460

(1)
> 

Generate⁡integer⁡range=2..7

3

(2)
> 

seq⁡Generate⁡integer,i=1..10

−306860183579,−477575829529,300187484465,−72447943125,342622684448,−87713714154,496417214186,−113591692544,194607189271,273012980029

(3)
> 

Generate⁡list⁡integer⁡range=−5..5,10

5,−3,3,4,−4,5,2,4,3,5

(4)
> 

Matrix⁡3,3,Generate⁡integer⁡range=2..7⁢identical⁡x+integer⁡range=2..7,makeproc=true

2⁢x+76⁢x+75⁢x+47⁢x+64⁢x+65⁢x+43⁢x+42⁢x+24⁢x+6

(5)
> 

Generate⁡integer⁡range=−10..10,exclude=0,1,−1

−6

(6)
> 

seq⁡Generate⁡integer⁡range=−5..5,exclude=0,1,−1,i=1..20

4,4,4,5,−4,2,−2,−4,3,3,−2,−3,4,3,4,5,−2,3,2,3

(7)

See Also

flavor/structured

integer

rand

RandomTools

RandomTools[Generate]