org.scalacheck

object Gen

[source: org/scalacheck/Gen.scala]

object Gen
extends AnyRef
Contains combinators for building generators.
Value Summary
val defaultParams : Params
Method Summary
def alphaChar : Gen[Char]
def alphaLowerChar : Gen[Char]
def alphaNumChar : Gen[Char]
def alphaStr : Gen[java.lang.String]
def alphaUpperChar : Gen[Char]
def apply [T](g : (Params) => scala.Option[T]) : Gen[T]
def choose (low : Int, high : Int) : Gen[Int]
A generator that generates a random integer in the given (inclusive) range.
def choose (low : Double, high : Double) : Gen[Double]
A generator that generates a random double in the given (inclusive) range.
def choose (low : Long, high : Long) : Gen[Long]
A generator that generates a random integer in the given (inclusive) range.
def containerOf [C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.
def containerOf1 [C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a non-empty container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.
def containerOfN [C, T](n : Int, g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the generated container is given by n.
def elements [T](xs : T*) : Gen[T]
A generator that returns a random element from a list
def elementsFreq [T](vs : (Int, T)*) : Gen[T]
Chooses one of the given values, with a weighted random distribution.
def fail [T] : Gen[T]
A generator that never generates a value
implicit def freqTuple [T](t : (Int, T)) : (Int, Gen[T])
def frequency [T](gs : (Int, Gen[T])*) : Gen[T]
Chooses one of the given generators with a weighted random distribution
def identifier : Gen[java.lang.String]
def listOf [T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf[List,T](g).
def listOf1 [T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a non-empty list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf1[List,T](g).
def listOfN [T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).
def lzy [T](g : => Gen[T]) : Gen[T]
Wraps a generator lazily. The given parameter is only evalutated once, and not until the wrapper generator is evaluated.
def negInt : Gen[Int]
def numChar : Gen[Char]
def numStr : Gen[java.lang.String]
def oneOf [T](gs : Gen[T]*) : Gen[T]
Picks a random generator from a list
def parameterized [T](f : (Params) => Gen[T]) : Gen[T]
Creates a generator that can access its generation parameters
def pick [T](n : Int, l : scala.Collection[T]) : Gen[scala.Seq[T]]
A generator that picks a given number of elements from a list, randomly
def posInt : Gen[Int]
def resize [T](s : Int, g : Gen[T]) : Gen[T]
Creates a resized version of a generator
def sequence [C, T](gs : scala.Iterable[Gen[T]])(implicit b : Buildable[C]) : Gen[C[T]]
Sequences generators. If any of the given generators fails, the resulting generator will also fail.
def sized [T](f : (Int) => Gen[T]) : Gen[T]
Creates a generator that can access its generation size
def someOf [T](l : scala.Collection[T]) : Gen[scala.Seq[T]]
A generator that picks a random number of elements from a list
implicit def value [T](x : T) : Gen[T]
A generator that always generates the given value
def vectorOf [T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).
def wrap [T](g : => Gen[T]) : Gen[T]
Wraps a generator for later evaluation. The given parameter is evaluated each time the wrapper generator is evaluated.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
case class Params (val size : Int, val rng : java.util.Random) extends scala.Product
Record that encapsulates all parameters required for data generation
Value Details
val defaultParams : Params

Method Details
def apply[T](g : (Params) => scala.Option[T]) : Gen[T]

implicit def freqTuple[T](t : (Int, T)) : (Int, Gen[T])

def sequence[C, T](gs : scala.Iterable[Gen[T]])(implicit b : Buildable[C]) : Gen[C[T]]
Sequences generators. If any of the given generators fails, the resulting generator will also fail.

def lzy[T](g : => Gen[T]) : Gen[T]
Wraps a generator lazily. The given parameter is only evalutated once, and not until the wrapper generator is evaluated.

def wrap[T](g : => Gen[T]) : Gen[T]
Wraps a generator for later evaluation. The given parameter is evaluated each time the wrapper generator is evaluated.

implicit def value[T](x : T) : Gen[T]
A generator that always generates the given value

def fail[T] : Gen[T]
A generator that never generates a value

def choose(low : Int, high : Int) : Gen[Int]
A generator that generates a random integer in the given (inclusive) range.

def choose(low : Long, high : Long) : Gen[Long]
A generator that generates a random integer in the given (inclusive) range.

def choose(low : Double, high : Double) : Gen[Double]
A generator that generates a random double in the given (inclusive) range.

def parameterized[T](f : (Params) => Gen[T]) : Gen[T]
Creates a generator that can access its generation parameters

def sized[T](f : (Int) => Gen[T]) : Gen[T]
Creates a generator that can access its generation size

def resize[T](s : Int, g : Gen[T]) : Gen[T]
Creates a resized version of a generator

def frequency[T](gs : (Int, Gen[T])*) : Gen[T]
Chooses one of the given generators with a weighted random distribution

def oneOf[T](gs : Gen[T]*) : Gen[T]
Picks a random generator from a list

@scala.deprecated

def elementsFreq[T](vs : (Int, T)*) : Gen[T]
Chooses one of the given values, with a weighted random distribution.
Deprecated
Use frequency with constant generators instead.

@scala.deprecated

def elements[T](xs : T*) : Gen[T]
A generator that returns a random element from a list
Deprecated
Use oneOf with constant generators instead.

def containerOfN[C, T](n : Int, g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the generated container is given by n.

def containerOf[C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.

def containerOf1[C, T](g : Gen[T])(implicit b : Buildable[C]) : Gen[C[T]]
Generates a non-empty container of any type for which there exists an implicit Buildable instance. The elements in the container will be generated by the given generator. The size of the container is bounded by the size parameter used when generating values.

def listOf[T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf[List,T](g).

def listOf1[T](g : => Gen[T]) : Gen[scala.List[T]]
Generates a non-empty list of random length. The maximum length depends on the size parameter. This method is equal to calling containerOf1[List,T](g).

def listOfN[T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).

@scala.deprecated

def vectorOf[T](n : Int, g : Gen[T]) : Gen[scala.List[T]]
Generates a list of the given length. This method is equal to calling containerOfN[List,T](n,g).
Deprecated
Use the method listOfN instead.

def someOf[T](l : scala.Collection[T]) : Gen[scala.Seq[T]]
A generator that picks a random number of elements from a list

def pick[T](n : Int, l : scala.Collection[T]) : Gen[scala.Seq[T]]
A generator that picks a given number of elements from a list, randomly

def numChar : Gen[Char]

def alphaUpperChar : Gen[Char]

def alphaLowerChar : Gen[Char]

def alphaChar : Gen[Char]

def alphaNumChar : Gen[Char]

def identifier : Gen[java.lang.String]

def alphaStr : Gen[java.lang.String]

def numStr : Gen[java.lang.String]

def posInt : Gen[Int]

def negInt : Gen[Int]