How can I get the sourcecode for rand() (C++)?

后端 未结 6 1505
春和景丽
春和景丽 2020-12-31 11:01

I\'m new to programming.

I want to know exactly what rand() does.

Searching only yields examples on its usage. But none explain each step of how the function

6条回答
  •  旧时难觅i
    2020-12-31 11:43

    Well, I believe rand is from the C standard library, not the C++ standard library. There is no one implementation of either library, there are several.

    You could go somewhere like this page to view the source code for glibc, the c library used on most Linux distributions. For glibc you'd find it in source files under stdlib such as rand.c and random.c.

    A different implementation, such as uClibc might be easier to read. Try here under the libc/stdlib folder.

提交回复
热议问题