如何读取srand的值(time(null)) [英] how to read value of srand(time(null))

查看:125
本文介绍了如何读取srand的值(time(null))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C的新手。我正在使用srand(time(null))来播种时间值。我的问题是如何检索此函数播种的值?我想在屏幕上显示值

解决方案

看到这个, srand - C ++参考 [ ^ ]。它设置种子,然后调用rand()来获取值。


时间(null) value是 rand()调用的返回值。

有关示例,请参阅 RyanDev 提出的链接

i am new to C . I am using srand(time(null)) to 'seed' a time value. My question is how to retrieve the value seeded by this function? i want to display the value on the screen

解决方案

See this, srand - C++ Reference[^]. It sets up the seed then you call rand() to get the value.


The value 'seeded' by the time(null) value is the return value of the rand() call.
See the link proposed by RyanDev for an example.


这篇关于如何读取srand的值(time(null))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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