Source Code

Provides utility functions to generate random Whole values.

By: John Vasileff
License: http://opensource.org/licenses/MIT
Packages
com.vasileff.ceylon.random.whole
Dependencies
ceylon.random1.2.1
ceylon.whole1.2.1
Functions
randomWholeSource Codeshared Whole randomWhole(Whole origin, Whole bound, Random random = ...)

Generate a pseudorandom Whole number in the range origin (inclusive) to bound (exclusive).

Parameters:
  • origin

    The lower bound, inclusive. May be negative.

  • bound

    The upper bound, exclusive. Must be greater than origin.

  • random = DefaultRandom()

    The entropy source.

Throws
  • Exception

    if origin <= bound

randomWholeBitsSource Codeshared Whole randomWholeBits(Integer bits, Random random = ...)

Generate a Whole number holding bits pseudorandom bits. This method returns zero if bits <= 0.

Parameters:
  • bits

    The number of bits.

  • random = DefaultRandom()

    The entropy source.