summaryrefslogtreecommitdiff
path: root/lib/ldpc/peg/Random.C
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
commit5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch)
tree410fa358a5f73260a579b4d669730f319a4d2609 /lib/ldpc/peg/Random.C
parent6c82050de806dcdafaed0077400a6c3396a4a159 (diff)
parente0737c56c1e384e05064a0c6e1ac46979371041b (diff)
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack' with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'lib/ldpc/peg/Random.C')
-rw-r--r--lib/ldpc/peg/Random.C101
1 files changed, 0 insertions, 101 deletions
diff --git a/lib/ldpc/peg/Random.C b/lib/ldpc/peg/Random.C
deleted file mode 100644
index 3c5d5438..00000000
--- a/lib/ldpc/peg/Random.C
+++ /dev/null
@@ -1,101 +0,0 @@
-
-#include <cmath>
-#include <algorithm>
-#include "Random.h"
-
-void Random::bubbleSort(int a[], int size)
-{
- for(int pass=1; pass<size; pass++) {
- for(int i=0;i<size-pass;i++)
- if(a[i]>a[i+1]){
- std::swap(a[i], a[i+1]);
- }
- }
-}
-
-double Random::gauss(double sdev, double mean)
-{
- double sum=0.0;
- for (int i=1;i<=12;++i)
- {
- seed_u = 1664525lu * seed_u + 123456789lu;
- sum+=double(seed_u);
- }
- return (sum/4.29497e9-6.0)*sdev+mean;
-}
-
-double Random::uniform(double a, double b)
-{
- double t;
- for(int i=0; i<10;i++){
- seed=2045*seed+1;
- //seed=seed -(seed/1048576)*1048576;
- seed%=1048576;
- }
- t=seed/1048576.0;
- t=a+(b-a)*t;
- return(t);
-}
-
-int Random::uniform(int a, int b) // [a, b-1]
-{
- double t;
- int i, tt;
- if(b==a+1) return(a);
- for(i=0; i<10;i++){
- seed=2045*seed+1;
- //seed=seed -(seed/1048576)*1048576;
- seed%=1048576;
- }
- t=seed/1048576.0;
- t=a+(b-a)*t;
- tt=(int)t;
- if(tt<a) tt=a;
- else if(tt>=b) tt=b-1;
- return(tt);
-}
-
-int Random::nonUniform(int a, int b) // [a, b-1]
-{
- double t;
- int i, tt;
- if(b==a+1) return(a);
- for(i=0; i<10;i++){
- seed=2045*seed+1;
- //seed=seed -(seed/1048576)*1048576;
- seed%=1048576;
- }
- t=seed/1048576.0;
- t=a+(b-a)*pow(t, 0.6667); //t^1.5
- tt=(int)t;
- if(tt<a) tt=a;
- else if(tt>=b) tt=b-1;
- return(tt);
-}
-
-/*
-void m_uniform(int a , int b, long int *seed, int *itmp, int num)
-{
- int index, imed, i, k;
-
- index=0;
- itmp[0]=uniform(a, b, seed);
- Loop1:
- imed=uniform(a, b, seed);
- k=0;
- for(i=0;i<=index;i++)
- if(imed==itmp[i]) {k=1; break;}
- if(k==0) {index++; itmp[index]=imed;}
- if(index<num-1) goto Loop1;
- bubble(itmp, num); //bubble sorting
-}
-*/
-
-
-
-
-
-
-
-
-