随机生成数

Posted minttremor

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了随机生成数相关的知识,希望对你有一定的参考价值。

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

void main()
{
time_t ts;
srand((unsigned int)time(&ts));
int a[10];
for (int i = 0; i < 10; i++)
{
a[10] = rand() % 100;
printf(" %d,%x",a[10],&a[10]);
}
int all = 0;
double total = 0.0;
for (int i = 0; i < 10; i++)
{
all += a[10];

}
total = all;
total /= 10;
printf(" 和=%d,平均值=%f", all, total);


getchar();
}






















以上是关于随机生成数的主要内容,如果未能解决你的问题,请参考以下文章

js生成一组随机数,找出最大数

怎么用matlab生成随机数,排序,取数排序前的位置?

随机生成16位的16进制数

postman随机生成数

35python模块学习-radom随机生成数

C#中随机生成的十六进制数