X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Frandom.h;h=5fe50b725a160ad017f56af85e82f6ccdfdb4f13;hb=28c5588e8e1a8d091c5d2275232c35f2968a97fa;hp=c698638597a4977f334b98dbce02d1c47d3e21d6;hpb=78f3f3164021402d7dbca495d1f3f48d81d9a353;p=sliver-openvswitch.git diff --git a/lib/random.h b/lib/random.h index c69863859..5fe50b725 100644 --- a/lib/random.h +++ b/lib/random.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 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,9 +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); -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 */