Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/math/distributions/normal.hpp>
- #include <iostream>
- #include <fstream>
- using namespace boost::math;
- using namespace std;
- int main(){
- int max=512;
- int il=550;
- normal_distribution<double> nd;
- int table[max];
- std::fstream faa("helper.txt",ios_base::out|ios_base::binary);
- for (int i=1; i<max; i++)
- table[i]=(int)(quantile(nd,i/(max*1.0))*il);
- int min=table[1];
- int mmax=table[max-1];
- faa.write((char*)&max,4);
- faa.write((char*)&il,4);
- double dmax=int((quantile(nd,(max-1)/(max*1.0))*il))/(il*1.0);
- double dmin=int((quantile(nd,1/(max*1.0))*il))/(il*1.0);
- faa.write((char*)&dmin,8);
- faa.write((char*)&dmax,8);
- int writhe=mmax-min;
- faa.write((char*)&writhe,4);
- int* curr=table+1;
- for(int i=0; i<mmax-min; i++){
- if (i+min>*curr) {
- curr++;
- }
- int p=(curr-table);
- cout<<i<<' '<<p<<endl;
- faa.write((char*)&p,4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement