2012-06-21 00:04:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								USING:  help.markup  help.syntax  math  kernel  sequences  arrays  ;
  
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								IN:  random  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  seed-random  
						 
					
						
							
								
									
										
										
										
											2009-09-30 04:22:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
									
										
										
										
											2014-02-06 20:54:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { "obj"  "a random number generator"  }
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 04:22:11 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { "seed"  "a seed specific to the random number generator"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Seed the random number generator. Repeatedly seeding the random number generator should provide the same sequence of random numbers."  }
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $notes "Not supported on all random number generators."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 16:56:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-32*  
						 
					
						
							
								
									
										
										
										
											2014-02-06 21:17:03 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "obj"  "a random number generator"  } { "n"  "an integer between 0 and 2^32-1"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Generates a random 32-bit unsigned integer."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  random-bytes*  
						 
					
						
							
								
									
										
										
										
											2014-02-06 20:54:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  "an integer"  } { "obj"  "a random number generator"  } { "byte-array"  "a sequence of random bytes"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Generates a byte-array of random bytes."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  random  
						 
					
						
							
								
									
										
										
										
											2010-01-14 13:45:30 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "obj"  object  } { "elt"  "a random element"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs a random element of the input object, or outputs "  { $link f  } " if the object contains no elements."  }
							 
						 
					
						
							
								
									
										
										
										
											2008-10-05 16:14:05 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $unchecked-example "USING: random prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "10 random ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "3"  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $unchecked-example "USING: random prettyprint ;" 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-05 23:08:13 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        "SYMBOL: heads" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "SYMBOL: tails" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "{ heads tails } random ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        "heads"  }
							 
						 
					
						
							
								
									
										
										
										
											2008-10-05 16:14:05 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 16:56:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-32  
						 
					
						
							
								
									
										
										
										
											2009-09-30 19:52:01 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "n"  "a 32-bit random integer"  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 16:56:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Outputs 32 random bits. This word is more efficient than calling "  { $link random } " because no scaling is done on the output."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  random-bytes  
						 
					
						
							
								
									
										
										
										
											2008-03-29 21:12:22 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  "an integer"  } { "byte-array"  "a random integer"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-09-09 16:39:40 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Outputs an integer with n bytes worth of bits."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $unchecked-example "USING: prettyprint random ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "5 random-bytes ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "B{ 135 50 185 119 240 }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-21 00:04:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-integers  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "length"  integer  } { "n"  integer  } { "sequence"  array  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs an array with "  { $snippet "length"  } " random integers from [0,n)."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $unchecked-example "USING: prettyprint random ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "10 100 random-integers ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "{ 32 62 71 89 54 12 57 57 10 19 }" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 13:11:51 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-unit  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "n"  float  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs a random uniform float from [0,1]."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-21 00:04:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-units  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "length"  integer  } { "sequence"  array  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs an array with "  { $snippet "length"  } " random uniform floats from [0,1]."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { $unchecked-example "USING: prettyprint random ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "7 random-units ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               "{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.1881956429982787
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.9063571897519639
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.9550470241550406
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.6289397941552234
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.9441213853903183
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.7673290082934152
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    0.573743749061385
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  random-bits  
						 
					
						
							
								
									
										
										
										
											2014-02-06 21:17:03 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "numbits"  integer  } { "n"  "a random integer"  } }
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{ $description "Outputs an random integer n bits in length."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-10 14:39:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  random-bits*  
						 
					
						
							
								
									
										
										
										
											2014-02-06 21:17:03 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "numbits"  integer  } { "n"  "a random integer"  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-05-10 14:39:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Returns an integer exactly "  { $snippet "numbits"  } " in length, with the topmost bit set to one."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								HELP:  with-random  
						 
					
						
							
								
									
										
										
										
											2014-02-06 20:54:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $values { "obj"  "a random number generator"  } { "quot"  "a quotation"  } }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Calls the quotation with the random number generator in a dynamic variable.  All random numbers will be generated using this random number generator."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								HELP:  with-secure-random  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  "a quotation"  } }
							 
						 
					
						
							
								
									
										
										
										
											2014-02-06 20:54:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Calls the quotation with the secure random number generator in a dynamic variable.  All random numbers will be generated using this random number generator."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-03-29 00:20:33 -04:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  with-system-random  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values { "quot"  "a quotation"  } }
							 
						 
					
						
							
								
									
										
										
										
											2014-02-06 20:54:33 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Calls the quotation with the system's random number generator in a dynamic variable.  All random numbers will be generated using this random number generator."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ with-random with-secure-random with-system-random } related-words
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 15:25:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  randomize  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { "seq"  sequence  }
							 
						 
					
						
							
								
									
										
										
										
											2010-02-18 18:31:52 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     { "randomized"  sequence  }
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 15:25:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Randomizes a sequence in-place with the Fisher-Yates algorithm and returns the sequence."  } ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 13:04:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  sample  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { "seq"  sequence  } { "n"  integer  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { "seq'"  sequence  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $description "Takes "  { $snippet "n"  } " samples at random without replacement from a sequence. Throws an error if "  { $snippet "n"  } " is longer than the sequence."  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $examples
							 
						 
					
						
							
								
									
										
										
										
											2010-01-30 01:58:29 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { $unchecked-example "USING: random prettyprint ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "{ 1 2 3 } 2 sample ." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    "{ 3 2 }" 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 13:04:06 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								HELP:  delete-random  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $values
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { "seq"  sequence  }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     { "elt"  object  } }
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 00:41:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $description "Deletes a random number from a sequence using "  { $link remove-nth!  } " and returns the deleted object."  } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "random-protocol"  "Random protocol" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								"A random number generator must implement one of these two words:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    random-32*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    random-bytes*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Optional, to seed a random number generator:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections seed-random } ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ARTICLE: "random"  "Generating random integers" 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-05 23:08:13 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"The "  { $vocab-link "random"  } " vocabulary contains a protocol for generating random or pseudorandom numbers."  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$nl
							 
						 
					
						
							
								
									
										
										
										
											2009-01-27 00:20:27 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"The “Mersenne Twister” pseudorandom number generator algorithm is the default generator stored in "  { $link random-generator } "."  
						 
					
						
							
								
									
										
										
										
											2008-10-05 23:08:13 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$nl
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Generate a random object:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections random }
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 16:56:02 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Efficient 32-bit random numbers:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections random-32 }
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Combinators to change the random number generator:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with-random
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with-system-random
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with-secure-random
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Implementation:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections "random-protocol"  }
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 15:25:48 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Randomizing a sequence:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections randomize }
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 13:24:50 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Sampling a sequences:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections sample }
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Deleting a random element from a sequence:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections delete-random }
							 
						 
					
						
							
								
									
										
										
										
											2012-06-21 00:04:57 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Sequences of random numbers:"  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{ $subsections random-bytes random-integers random-units }
							 
						 
					
						
							
								
									
										
										
										
											2009-05-10 14:39:08 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								"Random numbers with "  { $snippet "n"  } " bits:"  
						 
					
						
							
								
									
										
										
										
											2009-10-01 15:56:36 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{ $subsections
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    random-bits
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    random-bits*
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} ;
 
							 
						 
					
						
							
								
									
										
										
										
											2008-10-04 12:44:12 -04:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								ABOUT: "random"