Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3116)

Issue 7235056: Add additional random number generator (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 5 months ago by JimVV
Modified:
11 years, 5 months ago
Reviewers:
reed1
CC:
skia-review_googlegroups.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Add additional random number generator. This adds SkMWCRandom, which generates random numbers using George Marsaglia's multiply-with-carry method. The current linear congruent generator method fails all three of the tuftests suite (http://www.cs.hku.hk/cisc/projects/va/index.htm#download), whereas this one passes all three. Because this stores four values instead of one, it's not possible to return a single seed for getSeed(), so that functionality has been changed to getState() and setState(). The methods nextF() has also been changed to use a faster method of generating numbers in the interval [0,1). Otherwise, the remaining methods are identical.

Patch Set 1 #

Total comments: 4

Patch Set 2 : Cleaned up some interface; fixed initialization #

Patch Set 3 : Changed getState/setState to copy constructor and assignment op #

Total comments: 1

Patch Set 4 : Simplified generator; capitalized name of static function #

Unified diffs Side-by-side diffs Delta from patch set Stats (+169 lines, -0 lines) Patch
M include/utils/SkRandom.h View 1 2 3 1 chunk +169 lines, -0 lines 0 comments Download

Messages

Total messages: 7
JimVV
11 years, 5 months ago (2013-01-29 15:09:55 UTC) #1
reed1
https://codereview.appspot.com/7235056/diff/1/include/utils/SkRandom.h File include/utils/SkRandom.h (right): https://codereview.appspot.com/7235056/diff/1/include/utils/SkRandom.h#newcode164 include/utils/SkRandom.h:164: struct State { can we make these private (to ...
11 years, 5 months ago (2013-01-29 16:29:35 UTC) #2
JimVV
In addition to the changes below, I also fixed up the init() method. This random ...
11 years, 5 months ago (2013-01-29 19:07:24 UTC) #3
JimVV
Updated to change getState/setState to copy constructor and assignment operator. On 2013/01/29 19:07:24, JimVV wrote: ...
11 years, 5 months ago (2013-01-29 19:31:51 UTC) #4
reed1
lgtm w/ Capitalization nit https://codereview.appspot.com/7235056/diff/8001/include/utils/SkRandom.h File include/utils/SkRandom.h (right): https://codereview.appspot.com/7235056/diff/8001/include/utils/SkRandom.h#newcode312 include/utils/SkRandom.h:312: } Capitalize Static Functions
11 years, 5 months ago (2013-01-30 13:03:46 UTC) #5
JimVV
One last pass.... I figured out last night how to simply the generator down to ...
11 years, 5 months ago (2013-01-30 14:19:27 UTC) #6
reed1
11 years, 5 months ago (2013-01-30 14:57:17 UTC) #7
Do we need to rename it to include your initials as well?

lgtm
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b