10.13 Set Functions for Integers

As already mentioned in the first section of this chapter, Integers is the domain of all integers. Thus in principle all set theoretic functions, for example Intersection, Size, and so on can be applied to this domain. This seems generally of little use.

    gap> Intersection( Integers, [ 0, 1/2, 1, 3/2 ] );
    [ 0, 1 ]
    gap> Size( Integers );
    "infinity" 

Random( Integers )

This seems to be the only useful domain function that can be applied to the domain Integers. It returns pseudo random integers between -10 and 10 distributed according to a binomial distribution.

    gap> Random( Integers );
    1
    gap> Random( Integers );
    -4 

To generate uniformly distributed integers from a range, use the construct Random( [ low .. high ] ).

Previous Up Top Next
Index

GAP 3.4.4
April 1997