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

Issue 3053050: Add RandomNumberGenerator adapter to base/rand_util.h (Closed)

Created:
10 years, 4 months ago by isherman
Modified:
9 years, 7 months ago
CC:
chromium-reviews, ben+cc_chromium.org, darin-cc_chromium.org, cbentzel+watch_chromium.org, brettw-cc_chromium.org, Paweł Hajdan Jr.
Base URL:
http://src.chromium.org/git/chromium.git
Visibility:
Public.

Description

Add RandomNumberGenerator adapter to base/rand_util.h BUG=46679 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=57904

Patch Set 1 #

Total comments: 2

Patch Set 2 : Addressing review comments #

Total comments: 3

Patch Set 3 : Hiding the adapter, disabling the unit test #

Patch Set 4 : 64-bit generator, hey #

Patch Set 5 : Now with slightly improved comments #

Patch Set 6 : Now with more compiling #

Patch Set 7 : Compile on Windows, too... #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -9 lines) Patch
M base/rand_util.h View 1 2 3 4 2 chunks +8 lines, -1 line 1 comment Download
M base/rand_util.cc View 1 2 3 3 chunks +8 lines, -4 lines 0 comments Download
M base/rand_util_unittest.cc View 1 2 3 4 5 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/browser/views/first_run_search_engine_view.cc View 1 2 3 4 5 6 2 chunks +4 lines, -3 lines 0 comments Download
M net/websockets/websocket_handshake.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
isherman
Pretty sure I added more TODOs than code :P I intend to address those in ...
10 years, 4 months ago (2010-08-05 19:54:44 UTC) #1
Paweł Hajdan Jr.
How about adding a Shuffle function to the rand util with an interface similar to ...
10 years, 4 months ago (2010-08-05 22:11:49 UTC) #2
brettw
http://codereview.chromium.org/3053050/diff/1/3 File base/rand_util.h (right): http://codereview.chromium.org/3053050/diff/1/3#newcode23 base/rand_util.h:23: ptrdiff_t RandGenerator(ptrdiff_t max); It's confusing and potentially dangerous that ...
10 years, 4 months ago (2010-08-06 00:02:44 UTC) #3
isherman
http://codereview.chromium.org/3053050/diff/7001/8003 File base/rand_util_unittest.cc (right): http://codereview.chromium.org/3053050/diff/7001/8003#newcode33 base/rand_util_unittest.cc:33: ::testing::FLAGS_gtest_death_test_style = "fast"; This makes the test print out ...
10 years, 4 months ago (2010-08-19 08:44:23 UTC) #4
brettw
http://codereview.chromium.org/3053050/diff/7001/8003 File base/rand_util_unittest.cc (right): http://codereview.chromium.org/3053050/diff/7001/8003#newcode33 base/rand_util_unittest.cc:33: ::testing::FLAGS_gtest_death_test_style = "fast"; If verifying it DCHECKs is causing ...
10 years, 4 months ago (2010-08-19 15:59:06 UTC) #5
Paweł Hajdan Jr.
http://codereview.chromium.org/3053050/diff/7001/8002 File base/rand_util.h (right): http://codereview.chromium.org/3053050/diff/7001/8002#newcode26 base/rand_util.h:26: ptrdiff_t RandGeneratorForRandomShuffle(ptrdiff_t max); I'd prefer this to be hidden, ...
10 years, 4 months ago (2010-08-19 16:50:31 UTC) #6
brettw
On Thu, Aug 19, 2010 at 9:50 AM, <phajdan.jr@chromium.org> wrote: > > http://codereview.chromium.org/3053050/diff/7001/8002 > File ...
10 years, 4 months ago (2010-08-19 16:54:13 UTC) #7
isherman
On 2010/08/19 16:54:13, brettw wrote: > On Thu, Aug 19, 2010 at 9:50 AM, <mailto:phajdan.jr@chromium.org> ...
10 years, 4 months ago (2010-08-19 22:54:26 UTC) #8
brettw
Sorry to drag this out. I really preferred patch set 2, except I would not ...
10 years, 4 months ago (2010-08-20 23:51:19 UTC) #9
isherman
On 2010/08/20 23:51:19, brettw wrote: > Sorry to drag this out. No worries -- I'm ...
10 years, 4 months ago (2010-08-24 05:10:31 UTC) #10
isherman
ping :)
10 years, 4 months ago (2010-08-26 21:56:38 UTC) #11
brettw
LGTM
10 years, 3 months ago (2010-08-27 19:50:40 UTC) #12
isherman
phajdan.jr: wdyt?
10 years, 3 months ago (2010-08-27 21:58:04 UTC) #13
Paweł Hajdan Jr.
http://codereview.chromium.org/3053050/diff/28001/29002 File base/rand_util.h (right): http://codereview.chromium.org/3053050/diff/28001/29002#newcode24 base/rand_util.h:24: uint64 RandGenerator(uint64 max); I think I'd prefer a RandomShuffle ...
10 years, 3 months ago (2010-08-30 18:09:02 UTC) #14
isherman
10 years, 3 months ago (2010-08-30 21:05:16 UTC) #15
On 2010/08/30 18:09:02, Paweł Hajdan Jr. wrote:
> I think I'd prefer a RandomShuffle thing. The implementation seems to be small
> enough to fit inline in case we need this for template reasons. However, if
> Brett wouldn't like it, I'm fine with the current solution.

I think the main objection to RandomShuffle as an API here is that introduces
dependencies (e.g. pulling in <algorithm>) into various files that use rand_util
but don't need to shuffle anything.  Since it seems that everyone's more or less
ok with the current implementation, I'm going to go ahead and commit it -- if we
come up with a lightweight way to provide RandomShuffle in the API, we can
revisit the decision :)

Powered by Google App Engine
This is Rietveld 408576698