`posets/text/rand_poset` := TEXT(
`   `,
`FUNCTION:  rand_poset - random poset generator`,
` `,
`CALLING SEQUENCE:  rand_poset(n);`,
`                   rand_poset(n,p);`,
`                   rand_poset(n,coin);`,
` `,
`PARAMETERS:  n  = a positive integer`,
`             p  = a number specifying edge probabilities (0 < p < 1)`,
`           coin = a procedure for generating random coin tosses`,
`   `,
`SYNOPSIS:`,
`  rand_poset(n) uses the Maple pseudo random number generator 'rand' to`,
`  create a random poset on the vertex set {1,...,n} by the following`,
`  algorithm: for each ordered pair (i,j) such that 1 <= i < j <= n, the`,
`  procedure chooses to include or not include the relation i < j with`,
`  equal probability. The covering relation of the poset generated by`,
`  these relations is then returned.`,
`   `,
`  The distribution of posets induced by this algorithm is far from uniform.`,
`  It tends to favor "long-and-stringy" posets.`,
`   `,
`  If the optional second argument is a numeric value p (0 < p < 1), the`,
`  relation i < j with be included with probability p. Values of p less than`,
`  1/2 will tend to counteract the "long-and-stringy" effect.`,
`   `,
`  If the optional second argument is a procedure 'coin', then random`,
`  values are generated by calls to coin(). If coin() returns the value 1,`,
`  then the relation i<j will be included; if any other value is returned,`,
`  the relation will be omitted.`,
` `,
`EXAMPLES:`,
`  #results depend on the current state of the random number generator`,
`  rand_poset(10);                yields    {[1,3],[1,2],[2,6],[3,4],[4,6],`,
`                                      [4,8],[5,7],[6,7],[6,9],[8,9],[9,10]}`,
`  rand_poset(9,0.3);             yields`,
`                          {[1,5],[2,8],[3,5],[3,6],[4,5],[5,7],[6,9],[7,9]}`,
`  coin:=rand(1..4):`,
`  rand_poset(10,coin);           yields    {[1,5],[1,2],[2,6],[3,4],[3,5],`,
`                                     [5,7],[6,8],[6,9],[7,9],[7,10],[8,10]}`,
`   `,
`SEE ALSO:  covers, rand`,
NULL):

if `+`(0)=0 then # Maple V.4 or later
  print(INTERFACE_HELP(insert, topic=`posets/rand_poset`,
  helpfile=HomeLib, text=`posets/text/rand_poset`))
elif ceil(0)=0 then # Maple V.2 or V.3
  `help/posets/text/rand_poset`:=`posets/text/rand_poset`:
  save `help/posets/text/rand_poset`, cat(HomeLib,`/help/posets/text/rand_poset.m`)
fi:
