/usr/lib/tcltk/rivet2.1/rivet-tcl/random.tcl is in libapache2-mod-rivet 2.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ###
## random [seed | value ]
##
## Generate a random number using only Tcl code. This proc tries to
## emulate what the TclX random function does. If we don't have TclX
## though, this is a decent substitute.
##
## Note: random predates the existence of Tcl's built-in rand() function,
## that is a part of the expr command -- programmers should consider using
## Tcl's built-in rand() function as an alternative to this command.
##
## $Id: random.tcl 1212149 2011-12-08 21:57:35Z mxmanghi $
##
###
namespace eval ::rivet {
proc random {args} {
global _ran
if {[llength $args] > 1} {
set _ran [lindex $args 1]
} else {
set period 233280
if {[info exists _ran]} {
set _ran [expr { ($_ran*9301 + 49297) % $period }]
} else {
set _ran [expr { [clock seconds] % $period } ]
}
return [expr { int($args*($_ran/double($period))) } ]
}
}
}
|