Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Issue 156533002: Add more complex mixing of random seed. (Closed)

Created:
6 years, 10 months ago by Lasse Reichstein Nielsen
Modified:
6 years, 10 months ago
Reviewers:
floitsch, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Add more complex mixing of random seed. This changes the sequences generated by Random for a given seed, since the internal state will not be the same as for the unmixed seed. It is consistent between VM and dart2js. The provided integer seed is hashed as follows: uint64 hash = 0; while (seed > 0) { hash = hash * 1037 + mix64((int64)seed); seed >>= 64; } where mix64 mixes the bits of a 64-bit value. The hash is used to initialize the random generator's internal state. R=floitsch@google.com, iposva@google.com Committed: https://code.google.com/p/dart/source/detail?r=32412

Patch Set 1 #

Total comments: 25

Patch Set 2 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+186 lines, -58 lines) Patch
M runtime/lib/math.cc View 1 1 chunk +41 lines, -12 lines 0 comments Download
M sdk/lib/_internal/lib/math_patch.dart View 1 1 chunk +70 lines, -12 lines 0 comments Download
M tests/lib/math/random_test.dart View 1 chunk +75 lines, -34 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Lasse Reichstein Nielsen
6 years, 10 months ago (2014-02-06 07:15:52 UTC) #1
floitsch
LGTM with comments. https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc File runtime/lib/math.cc (right): https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc#newcode118 runtime/lib/math.cc:118: n = (~n) + (n << ...
6 years, 10 months ago (2014-02-06 15:39:48 UTC) #2
Ivan Posva
LGTM -ip https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc File runtime/lib/math.cc (right): https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc#newcode118 runtime/lib/math.cc:118: n = (~n) + (n << 21); ...
6 years, 10 months ago (2014-02-07 00:15:20 UTC) #3
Lasse Reichstein Nielsen
https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc File runtime/lib/math.cc (right): https://codereview.chromium.org/156533002/diff/1/runtime/lib/math.cc#newcode118 runtime/lib/math.cc:118: n = (~n) + (n << 21); // n ...
6 years, 10 months ago (2014-02-07 08:38:54 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/156533002/diff/1/sdk/lib/_internal/lib/math_patch.dart File sdk/lib/_internal/lib/math_patch.dart (right): https://codereview.chromium.org/156533002/diff/1/sdk/lib/_internal/lib/math_patch.dart#newcode105 sdk/lib/_internal/lib/math_patch.dart:105: var low = (seed & _MASK32) >> 0; Changed ...
6 years, 10 months ago (2014-02-07 08:41:11 UTC) #5
Lasse Reichstein Nielsen
6 years, 10 months ago (2014-02-07 08:42:51 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 manually as r32412 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698