X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Frandom.h;h=5fe50b725a160ad017f56af85e82f6ccdfdb4f13;hb=8381a3d36c45ebfdcf3e0dc3c5dace94912216ba;hp=5bb041e5e06a6a1189f1d9eea91aa3d868d79c13;hpb=ddc4f8e27f231b35df0c73a16bacc17396fb00f3;p=sliver-openvswitch.git diff --git a/lib/random.h b/lib/random.h index 5bb041e5e..5fe50b725 100644 --- a/lib/random.h +++ b/lib/random.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2012 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. @@ -24,10 +24,25 @@ 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); uint64_t random_uint64(void); -int random_range(int max); + +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 */