📄 initiali.c
字号:
/* file: initiali.c
*
* purpose: create an initial population of structures,
* and initalize some performance variables.
* This is called at the start of each experiment.
*/
#include <stdlib.h>
#include <time.h>
void
initiali(int **Popu,int p_size,int len)
{
int i;
int j;
double prob;
time_t t;
/* generate the initialzied population */
srand((unsigned) time(&t));
for (i=0;i<p_size;i++)
{
for (j=0;j<len;j++)
{
prob=(1.0*random(1000))/1000;
if (prob>0.5)
Popu[i][j]=1;
else
Popu[i][j]=0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -