A 32 bit integer. Integer inherits most of its behaviour from its superclass.
Executes function for all integers from zero to this minus one.
function |
a Function which is passed two arguments, both of which are the same integer from zero to this minus one. The reason two arguments are passed is for symmetry with the implementations of do in Collection. |
Executes function for all integers from this minus one to zero.
Executes function for all integers from this to endval, inclusive.
endval |
an Integer. |
function |
a Function which is passed two arguments, the first which is an integer from this to endval, and the second which is a number from zero to the number of iterations minus one. |
Executes function for all integers from this to endval, inclusive, stepping each time by stepval.
endval |
an Integer. |
stepval |
an Integer. |
function |
a Function which is passed two arguments, the first which is an integer from this to endval, and the second which is a number from zero to the number of iterations minus one. |
an Array of this size filled by objects generated from evaluating the function.
a Collection of class of this size filled by objects generated from evaluating the function.
an Interval from this to hi.
an array with a geometric series of this size from start.
an array with a fibonacci series of this size beginning with a and b.
the prime factors as array.
the factorial of this.
See also: Randomness
exclude |
an Integer. |
a random value from zero to this, excluding the value exclude.
exclude |
an Integer. |
a random value from this.neg to this, excluding the value exclude.
a Char which has the ASCII value of the receiver.
a Char which represents the receiver as an ASCII digit.
For example 5.asDigit
returns $5
.
an array with the binary digits (integer 0 or 1).
an array with the n-ary digits.
See also the complementary method SequenceableCollection: -convertDigits.
2007.asDigits; 2007.asDigits(2);
a string with the binary digits (0 or 1).
a string with the hexadecimal digits (integer 0 to F).
a string in IP format.
Interpret this as index into a scale with a given number of steps per ocatve.
2.degreeToKey([0, 2, 5, 7, 11]);
the gray code for the number.
2.grayCode
set nth bit to zero (bool = false) or one (bool = true)
{ _CLZ }
{ _CTZ }
number of required bits
true if dividable by 2 with no rest
true if not dividable by 2 with no rest
the next power of two greater than or equal to the receiver.
13.nextPowerOfTwo.postln; 64.nextPowerOfTwo.postln;
the whether the receiver is a power of two.
13.isPowerOfTwo.postln; 64.isPowerOfTwo.postln;
the nth prime number. The receiver must be from 0 to 6541.
[0,1,2,3,4,5].collect({ arg i; i.nthPrime; }).postln;
the next prime less than or equal to the receiver up to 65521.
25.prevPrime.postln;
the next prime less than or equal to the receiver up to 65521.
25.nextPrime.postln;
whether the receiver is prime.
25.isPrime.postln; 13.isPrime.postln;
the index of a prime number less than or equal to the receiver up to 65521. If the receiver is not a prime, the answer is nil.
23.indexOfPrime; 25.indexOfPrime;
a Boolean for whether or not the specified pid is running.
p = "cat".unixCmd; p.pidRunning; // cat will stay alive ("kill" + p).unixCmd p.pidRunning;