这是在此范围内未声明错误“ranf”的代码。该代码是关于生成具有初始位置和速度的随机数。我无法配置如何解决问题。
#include<iostream>
#include<fstream>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<map>
using namespace std;
const int N= 3000, nstep= 20000000, nps= 50000, nprint =1000, noverlap= 10000;
const double R=1, eps=0.95, Lbox=150,pssize= 500;
const double infty= 1e20, null= 1e-10;
vector<double> x(N), y(N), vx(N), vy(N);
vector<double> clist[N];
double Time = 0;
map<double, pair<int,int> > cseq;
void init(double tol)
{
bool overlap;
int i, j;
x[0]= ranf(Lbox-R-tol);
y[0]= ranf(Lbox-R-tol);
vx[0]=ranf(1);
vy[0]=ranf(1);
for(i=1;i<N;i++)
{
if(!(1 % 100)) cout << "Init " << i << endl;
do {
overlap = false;
x[i]= ranf(Lbox-R-tol);
y[i]= ranf(Lbox-R-tol);
j=0;
do {
overlap = ((x[i]-x[j])*(x[i]-x[j])+ (y[i]-y[j])*(y[i]-y[j]) < 4*(R+tol)*(R+tol));
}
while((++j<i) && !overlap);
}
while(overlap);
vx[i]=ranf(1);`enter code here`
vy(i)=ranf(1);
}
}