randnum.1 (1774B)
1 .Dd $Mdocdate$ 2 .Dt RANDNUM 1 3 .Os 4 .Sh NAME 5 .Nm randnum 6 .Nd produces random numbers in a range 7 .Sh SYNOPSIS 8 .Nm 9 .Op Fl d Ar delimstr 10 .Op Fl n 11 .Op Fl N Ar num 12 .Op Fl p Ar prec 13 .Op Fl s Ar seed 14 .Oo 15 .Op Ar min_val 16 .Ar max_val 17 .Oc 18 .Sh DESCRIPTION 19 .Nm 20 randomly generates evenly distributed double-precision numbers, by in 21 the range 22 .Ar [ min_val ; 23 .Ar max_val ]. 24 If 25 .Ar max_val 26 is not specified, it is 1. 27 If 28 .Ar min_val 29 is not specified, it is 0. 30 If 31 .Ar min_val 32 and/or 33 .Ar max_val 34 are negative, they must be prefixed with the '--' option. 35 .Pp 36 The number values are drawn from a pseudo-random number generator, 37 seeded from current time of day with microsecond resolution. 38 Invocations of 39 .Nm 40 within the same microsecond will produce the same result. 41 .Pp 42 The options are as follows: 43 .Bl -tag -width Ds 44 .It Fl d Ar delimstr 45 Separate output values by 46 .Ar delimstr . 47 The default delimiter is newlines. 48 .It Fl n 49 Do not print a newline after the final value. 50 .It Fl N num 51 Number of random points to generate. 52 .It Fl p Ar prec 53 Print the output values with 54 .Ar prec 55 digits of precision. 56 By default, the output is printed with 17 digits of precision, which is 57 full double precision on 64-bit systems. 58 .It Fl s Ar seed 59 Seed the pseudo-random number generator with this value, which is used 60 to generate reproducible binning. 61 .El 62 .Sh EXAMPLES 63 Generate a single value in the default range [0;1[. 64 Due to the randomness, your output may differ: 65 .Dl $ randnum 66 .Dl 0.38385568287140259 67 .Pp 68 Generate five points in the range [-10;10[ and print with three 69 significant digits separated by spaces: 70 .Dl $ randnum -N 5 -p 3 -d ' ' -- -10 10 71 .Dl -5.52 -5.5 -3.88 3.49 -3.11 72 .Sh SEE ALSO 73 .Xr randcounts 1 , 74 .Xr range 1 , 75 .Xr rangetest 1 , 76 .Xr sum 1 77 .Sh AUTHORS 78 .An Anders Damsgaard Aq Mt anders@adamsgaard.dk