24
|
1 |
#======================================================================
|
|
2 |
# L I B R A N D . P L
|
|
3 |
# doc: Thu Nov 19 14:27:19 2015
|
25
|
4 |
# dlm: Tue Mar 8 15:50:35 2016
|
24
|
5 |
# (c) 2015 A.M. Thurnherr
|
25
|
6 |
# uE-Info: 10 27 NIL 0 0 72 2 2 4 NIL ofnI
|
24
|
7 |
#======================================================================
|
|
8 |
|
25
|
9 |
# HISTORY:
|
|
10 |
# Nov 19, 2015: - created
|
|
11 |
|
24
|
12 |
sub gauss_rand($$)
|
|
13 |
{
|
|
14 |
my($mu,$sigma) = &antsFunUsage(2,'ff','mu, sigma',@_);
|
|
15 |
}
|
|
16 |
|
|
17 |
#----------------------------------------------------------------------------------------------------
|
|
18 |
# From info found at [http://www.mathworks.com/matlabcentral/newsreader/view_thread/301276]
|
|
19 |
#
|
|
20 |
# verified with:
|
|
21 |
# plot '<Cat -Lrand -f =1,1,1e5 -F r=pwrlaw_rand(-2) | Hist -s 100 r | Cat -S $2>2' lt 3,x**-2*1e7
|
|
22 |
# plot '<Cat -Lrand -f =1,1,1e5 -F r=pwrlaw_rand(-3) | Hist r',x**-3*7e3
|
|
23 |
# plot '<Cat -Lrand -f =1,1,1e5 -F r=pwrlaw_rand(0) | Hist -s 0.01 r'
|
|
24 |
# plot '<Cat -Lrand -f =1,1,1e5 -F r=pwrlaw_rand(1) | Hist -s 0.01 r'
|
|
25 |
# plot '<Cat -Lrand -f =1,1,1e5 -F r=pwrlaw_rand(2) | Hist -s 0.01 r'
|
|
26 |
#----------------------------------------------------------------------------------------------------
|
|
27 |
|
|
28 |
sub pwrlaw_rand($)
|
|
29 |
{
|
|
30 |
my($p) = &antsFunUsage(1,'f','exponent',@_);
|
|
31 |
return rand() ** (1/($p+1));
|
|
32 |
}
|
|
33 |
|
|
34 |
1;
|