Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
8e4943b4
Commit
8e4943b4
authored
Jun 25, 2014
by
Kenton Varda
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #104 from dwrensha/xorshift
switch from linear congruential to Xorshift generator
parents
7b6ef1d5
dcf4b945
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
common.h
c++/src/capnp/benchmark/common.h
+13
-5
No files found.
c++/src/capnp/benchmark/common.h
View file @
8e4943b4
...
...
@@ -41,12 +41,20 @@
namespace
capnp
{
namespace
benchmark
{
// Use a 128-bit Xorshift algorithm.
static
inline
uint32_t
nextFastRand
()
{
static
constexpr
uint32_t
A
=
1664525
;
static
constexpr
uint32_t
C
=
1013904223
;
static
uint32_t
state
=
C
;
state
=
A
*
state
+
C
;
return
state
;
// These values are arbitrary. Any seed other than all zeroes is OK.
static
uint32_t
x
=
0x1d2acd47
;
static
uint32_t
y
=
0x58ca3e14
;
static
uint32_t
z
=
0xf563f232
;
static
uint32_t
w
=
0x0bc76199
;
uint32_t
tmp
=
x
^
(
x
<<
11
);
x
=
y
;
y
=
z
;
z
=
w
;
w
=
w
^
(
w
>>
19
)
^
tmp
^
(
tmp
>>
8
);
return
w
;
}
static
inline
uint32_t
fastRand
(
uint32_t
range
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment