Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,43 @@
|
|||
#define NRUNS 100000
|
||||
#define NBINS 20
|
||||
|
||||
function modifier( x as double ) as double
|
||||
return iif(x < 0.5, 2*(0.5 - x), 2*(x - 0.5))
|
||||
end function
|
||||
|
||||
function modrand() as double
|
||||
dim as double random1, random2
|
||||
do
|
||||
random1 = rnd
|
||||
random2 = rnd
|
||||
if random2 < modifier(random1) then
|
||||
return random1
|
||||
endif
|
||||
loop
|
||||
end function
|
||||
|
||||
function histo( byval bn as uinteger ) as string
|
||||
dim as double db = NRUNS/(50*NBINS)
|
||||
dim as string h
|
||||
while bn > db:
|
||||
h = h + "#"
|
||||
bn -= db
|
||||
wend
|
||||
return h
|
||||
|
||||
end function
|
||||
|
||||
dim as uinteger bins(0 to NBINS-1), i, b
|
||||
dim as double db = 1./NBINS, rand
|
||||
|
||||
randomize timer
|
||||
|
||||
for i = 1 to NRUNS
|
||||
rand = modrand()
|
||||
b = int(rand/db)
|
||||
bins(b) += 1
|
||||
next i
|
||||
|
||||
for b = 0 to NBINS-1
|
||||
print using "Bin ## (#.## to #.##): & ####";b;b*db;(b+1)*db;histo(bins(b));bins(b)
|
||||
next b
|
||||
Loading…
Add table
Add a link
Reference in a new issue