我用 1.6G 的CPU  
因为要产生大量的随机数
发现  RANDD()  很慢  
不知是不是我的算法有问题 请问  rand()一分钟能产生多少个随机数   50万以上有没有问题?

解决方案 »

  1.   

    据我所知,c中提供的随机数函数采用的是一种类似于lfsr算法的伪随机数生成方式,在种好种子后,只是几个简单的移位异或操作,速度应该和你的cpu速度有关
      

  2.   


    随机数的产生原理与实现http://asp.7i24.com/netcool/laoluo/articles/show_article.asp?Article_ID=24
    我个人认为这与你的计算机性能有关;如CPU Speed,总线频率,主板和内存主频等等
      

  3.   

    Specifies the seed value that determines the sequence of values RAND( ) returns.RAND( ) returns the same sequence of random numbers if you use the same seed value for nSeedValue the first time you issue RAND( ) followed by subsequent RAND( ) function calls without nSeedValue.If nSeedValue is negative the first time you issued RAND( ), a seed value from the system clock is used. To achieve the most random sequence of numbers, issue RAND( ) initially with a negative argument and then issue RAND( ) without an argument.If you omit nSeedValue, RAND( ) uses a default seed value of 100,001.
      

  4.   

    强烈建议使用随机数的产生原理与实现http://asp.7i24.com/netcool/laoluo/articles/show_article.asp?Article_ID=24附带的ASM程序;它肯定比rand快