diff options
Diffstat (limited to 'xdelta3/testing/random.h')
-rw-r--r-- | xdelta3/testing/random.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/xdelta3/testing/random.h b/xdelta3/testing/random.h index 8ff64db..6087f16 100644 --- a/xdelta3/testing/random.h +++ b/xdelta3/testing/random.h | |||
@@ -1,8 +1,19 @@ | |||
1 | /* -*- Mode: C++ -*- */ | 1 | /* xdelta3 - delta compression tools and library -*- Mode: C++ -*- |
2 | /* This is public-domain Mersenne Twister code, | 2 | Copyright 2016 Joshua MacDonald |
3 | * attributed to Michael Brundage. Thanks! | 3 | |
4 | * http://www.qbrundage.com/michaelb/pubs/essays/random_number_generation.html | 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | */ | 5 | you may not use this file except in compliance with the License. |
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
6 | #undef MT_LEN | 17 | #undef MT_LEN |
7 | #undef MT_IA | 18 | #undef MT_IA |
8 | class MTRandom { | 19 | class MTRandom { |
@@ -25,6 +36,9 @@ class MTRandom { | |||
25 | Init(seed); | 36 | Init(seed); |
26 | } | 37 | } |
27 | 38 | ||
39 | /* This Mersenne Twister code is attributed to Michael Brundage. Thanks! | ||
40 | * http://www.qbrundage.com/michaelb/pubs/essays/random_number_generation.html | ||
41 | */ | ||
28 | uint32_t Rand32 () { | 42 | uint32_t Rand32 () { |
29 | uint32_t y; | 43 | uint32_t y; |
30 | static unsigned long mag01[2] = { | 44 | static unsigned long mag01[2] = { |