diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-06 20:47:39 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-07 09:50:24 +0200 |
commit | 0b37a1b9eecf9b38310bde4a11c01a7962234450 (patch) | |
tree | 1f6b1836d69fe2e72d800397167f5b5ff02ed90a /vespalib | |
parent | a9ba7645226f200148de44a19aff204dd0841493 (diff) |
Hide BucketId::List
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/random/friendfinder.cpp | 2 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/random.cpp | 3 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/random.h | 17 |
3 files changed, 9 insertions, 13 deletions
diff --git a/vespalib/src/tests/random/friendfinder.cpp b/vespalib/src/tests/random/friendfinder.cpp index 5f6e55815e5..7bf390ef083 100644 --- a/vespalib/src/tests/random/friendfinder.cpp +++ b/vespalib/src/tests/random/friendfinder.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/random.h> -#include <stdio.h> #include <vespa/vespalib/stllike/string.h> #include <cmath> +#include <vector> int main(int argc, char **argv) { diff --git a/vespalib/src/vespa/vespalib/util/random.cpp b/vespalib/src/vespa/vespalib/util/random.cpp index 06bfc1f9c25..2abf67605a8 100644 --- a/vespalib/src/vespa/vespalib/util/random.cpp +++ b/vespalib/src/vespa/vespalib/util/random.cpp @@ -2,6 +2,9 @@ #include "random.h" #include <cmath> +#include <cstring> +#include <ctime> +#include <unistd.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/random.h b/vespalib/src/vespa/vespalib/util/random.h index c4cce3b42d8..f9d2587272d 100644 --- a/vespalib/src/vespa/vespalib/util/random.h +++ b/vespalib/src/vespa/vespalib/util/random.h @@ -1,14 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <stdlib.h> -#include <stdio.h> -#include <inttypes.h> -#include <vespa/fastos/types.h> -#include <vector> -#include <sys/types.h> -#include <unistd.h> -#include <time.h> +#include <cstdint> namespace vespalib { @@ -22,9 +15,9 @@ private: /** * step the random generator once **/ - void iterate(void) { - _state = (UINT64_C(0x5DEECE66D) * _state + 0xb) & - UINT64_C(0xFFFFFFFFFFFF); + void iterate() { + _state = (0x5DEECE66Dul * _state + 0xb) & + 0xFFFFFFFFFFFFul; } /** @@ -73,7 +66,7 @@ public: * @brief reset the seed **/ void setSeed(int64_t seed) { - _state = (seed ^ UINT64_C(0x5DEECE66D)) & ((1L << 48) -1); + _state = (seed ^ 0x5DEECE66Dul) & ((1L << 48) -1); }; /** |