文件名称:gen_rand
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:759byte
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
这段源码可以在VC上运行,稍加改动就可以在其他C或C++下运行。它能以70多M字节/秒产生真随机数。为了简单这里产生10M字节的随机数,放在rand.dat文件里。可供考察。
之所以能产生随机数原理前面重复多次了。这里用的方法是先建造有规律的数组,以字节为单位,数值从0到255,不断重复。然后对这个数组进行随机排序,随机数来自Nm()函数,它读系统计数器的低32位数值做模256运算得到交换序列号n1,并让序列号为i和n1的数据交换数值,并充填结果数组。-This code can be run on the VC, little change in other C or C run. It can take more than 70 M bytes/sec generate true random numbers.
For simplicity here, 10M bytes of random number generation, on the rand.dat file. Available for inspection.
Principle has been able to generate random numbers in front of repeated many times. The method used here is to build a regular array, in bytes,
Value from 0 to 255, repeat. Then a random array of the sort, a random number from Nm () function, which counters the low reading system
Do 32-bit value to be exchanged computing model 256 serial number n1, and let the sequence number i and the value n1 of data exchange, and fill the result array.
之所以能产生随机数原理前面重复多次了。这里用的方法是先建造有规律的数组,以字节为单位,数值从0到255,不断重复。然后对这个数组进行随机排序,随机数来自Nm()函数,它读系统计数器的低32位数值做模256运算得到交换序列号n1,并让序列号为i和n1的数据交换数值,并充填结果数组。-This code can be run on the VC, little change in other C or C run. It can take more than 70 M bytes/sec generate true random numbers.
For simplicity here, 10M bytes of random number generation, on the rand.dat file. Available for inspection.
Principle has been able to generate random numbers in front of repeated many times. The method used here is to build a regular array, in bytes,
Value from 0 to 255, repeat. Then a random array of the sort, a random number from Nm () function, which counters the low reading system
Do 32-bit value to be exchanged computing model 256 serial number n1, and let the sequence number i and the value n1 of data exchange, and fill the result array.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
gen_rand.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.