xref: /llvm-project/libc/src/stdlib/rand_util.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
138b6f58eSMichael Jones //===-- Implementation header for rand utilities ----------------*- C++ -*-===//
238b6f58eSMichael Jones //
338b6f58eSMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
438b6f58eSMichael Jones // See https://llvm.org/LICENSE.txt for license information.
538b6f58eSMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
638b6f58eSMichael Jones //
738b6f58eSMichael Jones //===----------------------------------------------------------------------===//
838b6f58eSMichael Jones 
938b6f58eSMichael Jones #ifndef LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
1038b6f58eSMichael Jones #define LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
1138b6f58eSMichael Jones 
1286860be2SJoseph Huber #include "src/__support/CPP/atomic.h"
13daeee567SSiva Chandra Reddy #include "src/__support/macros/attributes.h"
14*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
15daeee567SSiva Chandra Reddy 
16*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
1738b6f58eSMichael Jones 
1886860be2SJoseph Huber // The ISO C standard does not explicitly require thread-safe behavior for the
1986860be2SJoseph Huber // generic `rand()` function. Some implementations expect it however, so we
2086860be2SJoseph Huber // provide it here.
2186860be2SJoseph Huber extern cpp::Atomic<unsigned long> rand_next;
2238b6f58eSMichael Jones 
23*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
2438b6f58eSMichael Jones 
2538b6f58eSMichael Jones #endif // LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
26