tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
11
Task/Random-numbers/Tcl/random-numbers.tcl
Normal file
11
Task/Random-numbers/Tcl/random-numbers.tcl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package require Tcl 8.5
|
||||
variable ::pi [expr acos(0)]
|
||||
proc ::tcl::mathfunc::nrand {} {
|
||||
expr {sqrt(-2*log(rand())) * cos(2*$::pi*rand())}
|
||||
}
|
||||
|
||||
set mean 1.0
|
||||
set stddev 0.5
|
||||
for {set i 0} {$i < 1000} {incr i} {
|
||||
lappend result [expr {$mean + $stddev*nrand()}]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue