可是经过反复测试,是生成的16位的随机数..
#include "stdafx.h"
#include <stdlib.h>
#include <time.h>
#include "conio.h"
void generate(unsigned int *R)
{
int i;;
time_t t;
srand((unsigned) time(&t));
printf("Ten random numbers:\n");
for(i=0; i<32; i++)
{
R[i]=rand()*rand();
printf("%x\n", R[i]);
}
}
int main(void)
{
unsigned int *R;R=new unsigned int[32];
generate(R);
getch();
return 0;
}
#include "stdafx.h"
#include <stdlib.h>
#include <time.h>
#include "conio.h"
void generate(unsigned int *R)
{
int i;;
time_t t;
srand((unsigned) time(&t));
printf("Ten random numbers:\n");
for(i=0; i<32; i++)
{
R[i]=rand()*rand();
printf("%x\n", R[i]);
}
}
int main(void)
{
unsigned int *R;R=new unsigned int[32];
generate(R);
getch();
return 0;
}
Ten random numbers:
89d9ea0
107eb108
12af1c0
1e3488ac
5e86a7f
72acb6f
1a5928a
317f883
47d81e4
3a6d988
11f9e460
20ba7cc
30f778da
1d0dcaf8
f54d434
6f70c74
d06eb7e
28d82fa9
1fd1db8d
19035106
d4623e0
2be5805
1beded80
95350a7
20727cbe
34090086
2e1ea8d8
8cc425
225505e7
20806e0
24b2dbb6
e6f8c10
这个结果是rand()*rand()得到的
下面是rand()得到:
Ten random numbers:
5eb4
2629
412e
5861
64b1
69fc
3b9c
41a7
2070
4c46
5f5f
54b7
5176
4ad0
3e30
7b36
1e66
6fb
73fd
2129
43bd
9a4
6b3c
3800
1abf
7e4a
3b7f
6ad3
cb2
2973
5648
67eb
谁能给我解释下