about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m')
-rw-r--r--sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m b/sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m
new file mode 100644
index 00000000..4f131fcb
--- /dev/null
+++ b/sourcecodes/bnt-master/SLP/misc/gener_discrete_dist.m
@@ -0,0 +1,12 @@
+function beta = gener_discrete_dist(N, alpha)
+% beta = gener_beta(N, masse)
+%
+%   using the logistic function to create a random vector
+%   of discrete probability distribution on N values
+%   if masse~=1 then sum(beta)==masse and this is not a probability
+% 
+% francois.olivier.c.h@gmail.com
+
+if nargin==1, alpha=1; end
+gamma = rand(1,N);
+beta  = alpha*N*(exp(gamma)/sum(exp(gamma)));