summaryrefslogtreecommitdiff
path: root/libpicosdk/rand.c
blob: e9c964f10ce5fbe15f1125c6a8533cfaec143a6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* libpicosdk/rand.c - Integrate pico_rand with libmisc
 *
 * Copyright (C) 2025  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#include <pico/rand.h>

#include <libmisc/_intercept.h>

uint32_t __lm_rand_uint31(void) {
	return get_rand_32() & UINT32_C(0x7fffffff);
}

uint32_t __lm_rand_uint32(void) {
	return get_rand_32();
}

uint64_t __lm_rand_uint62(void) {
	return get_rand_64() & UINT64_C(0x3fffffffffffffff);
}

uint64_t __lm_rand_uint63(void) {
	return get_rand_64() & UINT64_C(0x7fffffffffffffff);
}

uint64_t __lm_rand_uint64(void) {
	return get_rand_64();
}