Skip to content

Reproducability #468

Closed Answered by bkroller
Coderbitxh asked this question in Q&A
May 30, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @Coderbitxh,

I think the problem is that the explanation is a bit off with what a seed is.

Seeds are used to have a know starting point, so each consecutive call to a random method uses that seed. It does not only apply to the first call, it is for all consecutive calls.

When you set the seed, the first time you call random it will always return the same value* . Same happens for the rest of calls, the second return the same value each time (not the same as the first call), and so on.

Maybe an example is better. With the example code, we can modify it to call to times the rand function and get C and D. The next time you run it, you will get the same values for C and D. This is illustra…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Coderbitxh
Comment options

Answer selected by Coderbitxh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants