From f618466c25d43f3bae9e40920273bf77de1e1149 Mon Sep 17 00:00:00 2001 From: leochanj105 Date: Mon, 19 Oct 2020 23:09:30 -0400 Subject: initial sd-vbs initial sd-vbs add sd-vbs sd-vbs --- SD-VBS/common/matlab/randn.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 SD-VBS/common/matlab/randn.m (limited to 'SD-VBS/common/matlab/randn.m') diff --git a/SD-VBS/common/matlab/randn.m b/SD-VBS/common/matlab/randn.m new file mode 100644 index 0000000..e8eb473 --- /dev/null +++ b/SD-VBS/common/matlab/randn.m @@ -0,0 +1,22 @@ +%! _randn_f2_i1i1 + +function retRand = randn(m,n) + +retRand = ones(m,n); + +for i=1:m + for j=1:n + w = 10; + while(w>=1.0) + x1 = 2.0 * rand(1,1) - 1.0; + x2 = 2.0 * rand(1,1) - 1.0; + w = x1*x1 + x2*x2; + end + w = sqrt((-2.0*log(w))/w); + retRand(i,j) = x1*w; + end +end + + + + -- cgit v1.2.2