We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c0e72a commit 629e208Copy full SHA for 629e208
llama.cpp/random.cpp
@@ -0,0 +1,35 @@
1
+#include <random>
2
+#include <unistd.h>
3
+
4
+// TODO(jart): delete this with next cosmocc update
5
6
+namespace std {
7
8
+random_device::random_device(const string& __token)
9
+{
10
+ if (__token != "/dev/urandom")
11
+ __throw_system_error(ENOENT, ("random device not supported " + __token).c_str());
12
+}
13
14
+random_device::~random_device()
15
16
17
18
+unsigned
19
+random_device::operator()()
20
21
+ unsigned r;
22
+ size_t n = sizeof(r);
23
+ int err = getentropy(&r, n);
24
+ if (err)
25
+ __throw_system_error(errno, "random_device getentropy failed");
26
+ return r;
27
28
29
+double
30
+random_device::entropy() const noexcept
31
32
+ return 0;
33
34
35
+} // namespace std
0 commit comments