Bug 27030 - [WINCE] random number generator is too slow
Summary: [WINCE] random number generator is too slow
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 23154
  Show dependency treegraph
 
Reported: 2009-07-07 08:14 PDT by Joe Mason
Modified: 2009-07-14 13:22 PDT (History)
3 users (show)

See Also:


Attachments
patch adding mt19937ar.c for WinCE (8.64 KB, patch)
2009-07-07 08:32 PDT, Joe Mason
staikos: review-
Details | Formatted Diff | Diff
updated patch (9.49 KB, patch)
2009-07-07 10:40 PDT, Joe Mason
manyoso: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Mason 2009-07-07 08:14:04 PDT
The default WinCE RNG is very slow, so we replaced it with Mersenne Twister, which performs well and is well-studied.
Comment 1 Joe Mason 2009-07-07 08:32:38 PDT
Created attachment 32379 [details]
patch adding mt19937ar.c for WinCE
Comment 2 George Staikos 2009-07-07 09:20:40 PDT
Comment on attachment 32379 [details]
patch adding mt19937ar.c for WinCE

The initialization code should be brought inline with the current system where a function is called.
Comment 3 Joe Mason 2009-07-07 10:40:09 PDT
Created attachment 32386 [details]
updated patch

Done.  Also added an srand call so that the default RNG used to fill the initialization array for MT is itself initialized - I believe in the first patch it was always using the same seed.
Comment 4 Joe Mason 2009-07-07 10:47:20 PDT
Correction: the first patch did call srand because we called initializeRandomNumberGenerator before filling in the array.  The second patch needs to call srand explicitly because we replaced part of initializeRandomNumberGenerator instead of calling it first.
Comment 5 Eric Seidel (no email) 2009-07-07 15:54:04 PDT
Comment on attachment 32386 [details]
updated patch

The URL in the license http://www.math.keio.ac.jp/matumoto/emt.html is invalid.  Where can we go to validate that this code is properly licensed?
Comment 6 Joe Mason 2009-07-07 16:25:37 PDT
Current site seems to be http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html

The version of mt19937ar.c for download there is identical except that the url and contact email are different and it includes an extra test function:

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
Comment 7 George Staikos 2009-07-08 00:07:16 PDT
License is BSD.
Comment 8 Adam Treat 2009-07-14 07:51:39 PDT
Comment on attachment 32386 [details]
updated patch

License from given urls is BSD.  The copy that goes in should have updated url and contact info.  Otherwise looks good.
Comment 9 Adam Treat 2009-07-14 13:22:33 PDT
Landed with r45865.