1 //===-- random.cpp ----------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "gwp_asan/random.h"
10 #include "gwp_asan/guarded_pool_allocator.h"
15 uint32_t getRandomUnsigned32() {
16 thread_local uint32_t RandomState =
17 time(nullptr) + GuardedPoolAllocator::getThreadID();
18 RandomState ^= RandomState << 13;
19 RandomState ^= RandomState >> 17;
20 RandomState ^= RandomState << 5;
23 } // namespace gwp_asan