Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/random.h
Show First 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
get_random_long(void) | get_random_long(void) | ||||
{ | { | ||||
u_long val; | u_long val; | ||||
get_random_bytes(&val, sizeof(val)); | get_random_bytes(&val, sizeof(val)); | ||||
return (val); | return (val); | ||||
} | } | ||||
static inline uint64_t | |||||
get_random_u64(void) | |||||
{ | |||||
uint64_t val; | |||||
get_random_bytes(&val, sizeof(val)); | |||||
return (val); | |||||
} | |||||
static __inline uint32_t | static __inline uint32_t | ||||
prandom_u32(void) | prandom_u32(void) | ||||
{ | { | ||||
uint32_t val; | uint32_t val; | ||||
get_random_bytes(&val, sizeof(val)); | get_random_bytes(&val, sizeof(val)); | ||||
return (val); | return (val); | ||||
} | } | ||||
static inline u32 | static inline u32 | ||||
prandom_u32_max(u32 max) | prandom_u32_max(u32 max) | ||||
{ | { | ||||
return (arc4random_uniform(max)); | return (arc4random_uniform(max)); | ||||
} | } | ||||
#endif /* _LINUXKPI_LINUX_RANDOM_H_ */ | #endif /* _LINUXKPI_LINUX_RANDOM_H_ */ |