Data update
This commit is contained in:
parent
52a6ef48dd
commit
157b70a810
604 changed files with 14253 additions and 2100 deletions
|
|
@ -0,0 +1,39 @@
|
|||
include xpllib; \for Print
|
||||
|
||||
func real Modifier(X);
|
||||
real X;
|
||||
return if X < 0.5 then 2.*(0.5-X) else 2.*(X-0.5);
|
||||
|
||||
func real RGen;
|
||||
return float(Ran(1_000_000)) / 1e6;
|
||||
|
||||
func real RNG;
|
||||
real R1, R2;
|
||||
[loop [R1:= RGen;
|
||||
R2:= RGen;
|
||||
if R2 < Modifier(R1) then
|
||||
return R1;
|
||||
];
|
||||
];
|
||||
|
||||
def N = 100_000;
|
||||
def NUM_BINS = 20;
|
||||
def HIST_CHAR = ^#;
|
||||
def HIST_CHAR_SIZE = 125;
|
||||
def BinSize = 1. / float(NUM_BINS);
|
||||
int Bins(NUM_BINS), BN, I, J, Hist;
|
||||
real RN;
|
||||
[for I:= 0 to N-1 do
|
||||
[RN:= RNG;
|
||||
BN:= fix(Floor(RN/BinSize));
|
||||
Bins(BN):= Bins(BN)+1;
|
||||
];
|
||||
Print("Modified random distribution with %,d samples in range [0, 1):\n", N);
|
||||
Print(" Range Number of samples within that range\n");
|
||||
for I:= 0 to NUM_BINS-1 do
|
||||
[Hist:= Bins(I) / HIST_CHAR_SIZE;
|
||||
Print("%1.2f ..< %1.2f ", BinSize*float(I), BinSize*float(I+1));
|
||||
for J:= 1 to Hist do Print("%c", HIST_CHAR);
|
||||
Print(" %,d\n", Bins(I));
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue