X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frandom.c;h=a771c97ae624a2dd83bda57c95c062e316b77108;hb=5a78c3505ae7fa76a061e26676450049ec5946d5;hp=211986b722d00ae7bc41f7bf9a73e3935f152302;hpb=2b1638ca50138978705051fe9ea7fd64444459b4;p=libucw.git diff --git a/lib/random.c b/lib/random.c index 211986b7..a771c97a 100644 --- a/lib/random.c +++ b/lib/random.c @@ -14,6 +14,12 @@ /* We expect the random generator in libc to give at least 30 bits of randomness */ COMPILE_ASSERT(RAND_MAX_RANGE_TEST, RAND_MAX >= (1 << 30)-1); +uns +random_u32(void) +{ + return (random() & 0xffff) | ((random() & 0xffff) << 16); +} + uns random_max(uns max) {