Last login: Thu Aug 27 15:49:35 2009 from pc200424.maths. Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 4.11-STABLE (BELL) #1: Sat Oct 3 11:34:56 BST 2009 Welcome to the School of Maths Unix system. Type 'hogs' to see who is using disk space, or 'faq' for a list of questions and answers. *** bell ~$ cd ma3469/random/ bell ~/ma3469/random$ #The sequence of the random numbers generated by the most bell ~/ma3469/random$ # of random number generators always starts from the same bell ~/ma3469/random$ # point: bell ~/ma3469/random$ bell ~/ma3469/random$ ./fixed_state 1103527590 0.51387 377401575 0.175741 662824084 0.308652 1147902781 0.534534 2035015474 0.947628 368800899 0.171736 1508029952 0.702231 486256185 0.226431 1062517886 0.494773 267834847 0.12472 bell ~/ma3469/random$ ./fixed_state 1103527590 0.51387 377401575 0.175741 662824084 0.308652 1147902781 0.534534 2035015474 0.947628 368800899 0.171736 1508029952 0.702231 486256185 0.226431 1062517886 0.494773 267834847 0.12472 bell ~/ma3469/random$ bell ~/ma3469/random$ # (however, you are likely to get different numbers with a bell ~/ma3469/random$ # different version of C++ library, e.g. using one of bell ~/ma3469/random$ # FreeBSD 7.2 machines or Linux machines). bell ~/ma3469/random$ bell ~/ma3469/random$ # The simplest way to randomise the initial state of bell ~/ma3469/random$ # the random number generator is to set its initial bell ~/ma3469/random$ # "seed value" with the value of the system timer: bell ~/ma3469/random$ bell ~/ma3469/random$ ./random_state timer=1259529488 which means Sun Nov 29 21:18:08 2009 1932957705 0.900104 277326350 0.12914 1952963631 0.90942 1890140732 0.880165 10988485 0.00511691 1025005850 0.477306 1923091531 0.895509 518407720 0.241402 1012678465 0.471565 1003678950 0.467374 bell ~/ma3469/random$ ./random_state timer=1259529494 which means Sun Nov 29 21:18:14 2009 2111598231 0.98329 542591108 0.252664 2002405485 0.932443 80755874 0.0376049 107961651 0.0502736 876767472 0.408277 367001193 0.170898 2115600622 0.985153 473471375 0.220477 1451041820 0.675694 bell ~/ma3469/random$ bell ~/ma3469/random$ # To make sure that the generated numbers are indeed bell ~/ma3469/random$ # distributed uniformly, let's generate slightly more bell ~/ma3469/random$ # (30000) of them, split the unit interval into 30 bell ~/ma3469/random$ # equal parts (called "bins") and see how many of generated bell ~/ma3469/random$ # numbers get into each bin: bell ~/ma3469/random$ bell ~/ma3469/random$ ./uni_hist 0 0.986 986 0.0333333 0.999 999 0.0666667 0.959 959 0.1 1.012 1012 0.133333 0.958 958 0.166667 1.026 1026 0.2 0.992 992 0.233333 0.995 995 0.266667 0.989 989 0.3 0.951 951 0.333333 1.04 1040 0.366667 0.963 963 0.4 1.015 1015 0.433333 1.02 1020 0.466667 1.012 1012 0.5 0.985 985 0.533333 1.028 1028 0.566667 1.054 1054 0.6 1.019 1019 0.633333 0.983 983 0.666667 1.004 1004 0.7 0.977 977 0.733333 0.958 958 0.766667 0.993 993 0.8 1.052 1052 0.833333 0.972 972 0.866667 1.023 1023 0.9 1.111 1111 0.933333 0.956 956 0.966667 0.968 968 1 0.968 968 bell ~/ma3469/random$ bell ~/ma3469/random$ # Obviously, each run will generate a different bell ~/ma3469/random$ # distribution: bell ~/ma3469/random$ bell ~/ma3469/random$ ./uni_hist 0 1.029 1029 0.0333333 1.004 1004 0.0666667 1.03 1030 0.1 0.99 990 0.133333 0.974 974 0.166667 0.975 975 0.2 1.039 1039 0.233333 1.006 1006 0.266667 1.018 1018 0.3 1.015 1015 0.333333 0.989 989 0.366667 1.025 1025 0.4 1.022 1022 0.433333 0.976 976 0.466667 0.972 972 0.5 0.959 959 0.533333 1.022 1022 0.566667 1.006 1006 0.6 1.029 1029 0.633333 0.986 986 0.666667 0.959 959 0.7 0.993 993 0.733333 1.039 1039 0.766667 1.034 1034 0.8 0.929 929 0.833333 1.022 1022 0.866667 1.011 1011 0.9 0.999 999 0.933333 0.974 974 0.966667 0.974 974 1 0.974 974 bell ~/ma3469/random$ bell ~/ma3469/random$ ./uni_hist > uni_hist.out bell ~/ma3469/random$ bell ~/ma3469/random$ gnuplot G N U P L O T Version 3.7 patchlevel 3 last modified Thu Dec 12 13:00:00 GMT 2002 System: FreeBSD 4.11-STABLE Copyright(C) 1986 - 1993, 1998 - 2002 Thomas Williams, Colin Kelley and many others Type `help` to access the on-line reference manual The gnuplot FAQ is available from http://www.gnuplot.info/gnuplot-faq.html Send comments and requests for help to Send bugs, suggestions and mods to Terminal type set to 'unknown' gnuplot> # The bin values can be nicely plotted with the gnuplot> # steps format: gnuplot> gnuplot> set title "Random numbers per bin, total of 30 bins and 30000 numbers" gnuplot> plot "uni_hist.out" using 1:3 with steps gnuplot> gnuplot> # Exactly same curve can be plotted as a normalised distribution gnuplot> # of the random numbers: gnuplot> gnuplot> set title "Normalised distribution of random numbers" gnuplot> plot "uni_hist.out" with steps gnuplot> gnuplot> # (this takes the default columns 1:2).