random number 계산하기.

random number를 계산하면 그걸 열심히 반복연산하면 간단하고 명료한 사실을 깨닫게 된다.
random number가 random하게 생성되지 않는다.


이걸 풀려면 스마트(?)해지거나 혹은 몇가지 편법을 배우면 된다.
ps) 링크 본문 맨 아래 보면 논문하나 링크되어 있는데 쉬면서 읽으면 꿀잼.

When you call random_seed, it uses the time-of-day clock to initialize the seed, down to the second. I have seen it that if I rerun the program very quickly, I can get the same values. This is not likely to be an issue in a real application that runs longer than a second or isn’t rerun immediately.

I modified the program to add:

call sleepqq(1000)

before the call to random_seed, and this eliminated the duplicate sequence. This call waits one second.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s