Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/prng.h
- This file was added.
/*- | |||||
* This file is in the public domain. | |||||
* | |||||
* $FreeBSD$ | |||||
*/ | |||||
#pragma once | |||||
markm: We don't usually use these. Please use macro-based include guards instead. | |||||
cemAuthorUnsubmitted Done Inline ActionsFine, if y'all insist :-). cem: Fine, if y'all insist :-). | |||||
Done Inline ActionsPlease use include guards instead of non-standard pragma. kib: Please use include guards instead of non-standard pragma. | |||||
#define PCG_USE_INLINE_ASM 1 | |||||
#include <contrib/pcg-c/include/pcg_variants.h> | |||||
__uint32_t prng32(void); | |||||
__uint32_t prng32_bounded(__uint32_t bound); | |||||
__uint64_t prng64(void); | |||||
__uint64_t prng64_bounded(__uint64_t bound); | |||||
cemAuthorUnsubmitted Done Inline ActionsThese should probably be #ifdef _KERNEL to allow userspace inclusion of PCG via sys/prng.h. This might be useful for utilities in base that use random(3) or rand(3) today. cem: These should probably be `#ifdef _KERNEL` to allow userspace inclusion of PCG via `sys/prng.h`. | |||||
kibUnsubmitted Not Done Inline ActionsI do not think userspace would work because we do not install /usr/include/contrib/... . But braces cannot hurt anyway. kib: I do not think userspace would work because we do not install /usr/include/contrib/... . But… |
We don't usually use these. Please use macro-based include guards instead.