X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Frandom.h;h=5fe50b725a160ad017f56af85e82f6ccdfdb4f13;hb=003ce655b7116d18c86a74c50391e54990346931;hp=198adeabfa68d8be11def6fc5397b346f17ecedd;hpb=a14bc59fb8f27db193d74662dc9c5cb8237177ef;p=sliver-openvswitch.git diff --git a/lib/random.h b/lib/random.h index 198adeabf..5fe50b725 100644 --- a/lib/random.h +++ b/lib/random.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,10 +21,28 @@ #include void random_init(void); +void random_set_seed(uint32_t); + void random_bytes(void *, size_t); -uint8_t random_uint8(void); -uint16_t random_uint16(void); uint32_t random_uint32(void); -int random_range(int max); +uint64_t random_uint64(void); + +static inline int +random_range(int max) +{ + return random_uint32() % max; +} + +static inline uint8_t +random_uint8(void) +{ + return random_uint32(); +} + +static inline uint16_t +random_uint16(void) +{ + return random_uint32(); +} #endif /* random.h */