>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  Release

? Improved initial writing: 2005-07-05
last updated: 2006-07-17

? has been improved in the following ways:


1. RNGs

 

“Perhaps further research will show that even the random number generators recommended here are unsatisfactory; we hope this is not the case, but the history of the subject warns us to be cautious. The most prudent policy for a person to follow is to run a Monte Carlo program at least twice using quite different sources of random numbers before taking the answers of the program seriously; this not only will give an indication of the stability of the results, it will also guard against the danger of trusting in a generator with hidden deficiencies.”
          — Donald Knuth, The Art of Computer Programming, Volume 2, 3rd Edition, page 189.

 

Several instances of the foreign conjunction are provided to work with RNGs. See the dictionary page for ? for details.

9!:42 and 9!:43   RNG Select. Query/set the random number generator. The default is the Mersenne Twister.
9!:44 and 9!:45   RNG State. Query/set the random number generator state.
9!:0 and 9!:1   Random Seed. Query/set the random seed, a single integer or a list of integers.
128!:4  RNG Raw. Produces integers as directly generated by an RNG.


2. U(0,1) Random Numbers

The random numbers generated by ?0 have been changed to exclude 0. That is, (0&< *. <&1) ?0 .


Additional information on the Mersenne Twister can be found at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html . The Mersenne Twister requires the following legal notice:

Copyright © 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The names of its contributors may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


3. ?y and ?.y work on extended integers

For example:

   ? 10^40x
2154285081887547912265057746552303810402

   3 1 ?.@$ !50x
22092415123181713247802466594106002578660243928542852207957556146
 5668297708258026467682039213667133649564796051165631186210909260
13195975772731404715299571089521345645681260937994297669983918642


>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  Release