怎么随机生成一个64位的二进制串

来源:百度知道 编辑:UC知道 时间:2024/06/19 17:11:59

#include <stdio.h>
#include <stdlib.h>

int main ()
{
int string[64]; /*保留字符串*/
int i, count; /*count是计算几次*/
count = 3;
while (count --) {
for (i = 0; i < 64; i ++) {
string[i] = rand() % 2;
/*rand ()是c语言中随机数的产生器*/
} /*的函数*/
for ( i = 0; i < 64; i ++)
printf ("%d", string[i]);
printf ("\n");
}
return 0;
}