[libc-commits] [libc] [libc] Add separate `rand` implementation for baremetal (PR #96798)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Wed Jun 26 10:18:07 PDT 2024
================
@@ -0,0 +1,26 @@
+//===-- Implementation of rand --------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdlib/rand.h"
+#include "src/__support/common.h"
+#include "src/__support/threads/sleep.h"
+#include "src/stdlib/baremetal/rand_util.h"
+
+namespace LIBC_NAMESPACE {
+
+// An implementation of the xorshift64star pseudo random number generator. This
+// is a good general purpose generator for most non-cryptographics applications.
----------------
nickdesaulniers wrote:
Consider adding a note that this is not MT safe; baremetal callers will need to provide their own synchronization if they require such safety for this function.
https://github.com/llvm/llvm-project/pull/96798
More information about the libc-commits
mailing list