如何获得rand()(C ++)的源代码? [英] How can I get the sourcecode for rand() (C++)?

查看:288
本文介绍了如何获得rand()(C ++)的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程新手.

我想确切地知道rand()的作用.

I want to know exactly what rand() does.

仅搜索有关其用法的示例.但是没有人解释该函数如何生成随机数的每一步.他们将rand()视为黑盒.

Searching only yields examples on its usage. But none explain each step of how the function generates a random number. They treat rand() as a blackbox.

我想知道rand()在做什么;每一步.

I want to know what rand() is doing; each step.

是否有资源可以让我确切地看到rand()的作用? 这是所有开源的东西,不是吗?如果没有消息来源,我将接受反汇编.

Is there a resource that will allow me to see exactly what rand() does? This is all open source stuff isn't it? I'll settle for the disassembly, if there's no source.

我知道它会返回一个随机数,但是它如何生成该数字?我想看看每个步骤.

I know it returns a random number, but how does it generate that number? I want to see each step.

谢谢.

推荐答案

这是10秒钟的谷歌搜索时间:

This was 10 seconds of googling:

  • gcc implementation of rand()
  • How is the rand()/srand() function implemented in C
  • implementation of rand()

...

  • http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/api/a01206.html
  • http://www.gnu.org/software/libc/manual/html_node/Pseudo_002dRandom-Numbers.html

我本来要列出实际的搜索内容,但是看到这显然是一个骗局,我将投票为骗局"

I was gonna list the actual search, but seeing this is clearly a dupe, I'll just vote as dupe

这篇关于如何获得rand()(C ++)的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆