138b6f58eSMichael Jones //===-- Shared utility for rand -------------------------------------------===// 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 #include "src/stdlib/rand_util.h" 1086860be2SJoseph Huber #include "src/__support/CPP/atomic.h" 11daeee567SSiva Chandra Reddy #include "src/__support/macros/attributes.h" 12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 1338b6f58eSMichael Jones 14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 1538b6f58eSMichael Jones 1686860be2SJoseph Huber // C standard 7.10p2: If 'rand' is called before 'srand' it is to 1786860be2SJoseph Huber // proceed as if the 'srand' function was called with a value of '1'. 1886860be2SJoseph Huber cpp::Atomic<unsigned long> rand_next = 1; 1938b6f58eSMichael Jones 20*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 21