Skip to content

rand: add methods to allow greater control over PCGSource#30

Open
DeedleFake wants to merge 3 commits into
golang:masterfrom
DeedleFake:pcg-seed64
Open

rand: add methods to allow greater control over PCGSource#30
DeedleFake wants to merge 3 commits into
golang:masterfrom
DeedleFake:pcg-seed64

Conversation

@DeedleFake

@DeedleFake DeedleFake commented Apr 5, 2022

Copy link
Copy Markdown

For golang/go#49934.

Add two methods to PCGSource, Seed128 and State.

The standard Seed method only allows seeding with a uint64, but the PCG internal state is, effectively, a uint128. Seed128 allows the user to pass both the high and low bits for this state as two uint64s, allowing much greater control over the generator's state.

State does the opposite, returning the entire 128-bit state as two uint64s.

@DeedleFake

DeedleFake commented Apr 5, 2022

Copy link
Copy Markdown
Author

Should that be Seed128() instead? It's allowing you to set 128 bits of the generator's state, not 64.

@gopherbot

Copy link
Copy Markdown
Contributor

This PR (HEAD: 20a3031) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/exp/+/398354 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Rob Pike:

Patch Set 1:

(2 comments)


Please don’t reply on this GitHub thread. Visit golang.org/cl/398354.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

This PR (HEAD: 776a471) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/exp/+/398354 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Rob Pike:

Patch Set 3: Code-Review+2

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/398354.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Rob Pike:

Patch Set 3: -Code-Review

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/398354.
After addressing review feedback, remember to publish your drafts!

@gopherbot

Copy link
Copy Markdown
Contributor

This PR (HEAD: 7f2d908) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/exp/+/398354 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot

Copy link
Copy Markdown
Contributor

Message from Rob Pike:

Patch Set 4: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/398354.
After addressing review feedback, remember to publish your drafts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants