#define _CRT_RAND_S
#include <stdlib.h>
int mrand(int min, int max)
{
errno_t err;
unsigned int number;
err = rand_s(&number);
if (err != 0)
{ //产生失败,返回0
return 0;
}
unsigned nValue = (unsigned int)((double)number / ((double)UINT_MAX + 1) * double(max - min)) + min;
return nValue;
}
01-14
8328
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-10
6528
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-09