rand.h revision 6cb96ab7d4ba4dab39ef47e8d7c3dcfbf7582959
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * IPRT - Random Numbers and Byte Streams.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Copyright (C) 2006-2007 Sun Microsystems, Inc.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * This file is part of VirtualBox Open Source Edition (OSE), as
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * available from http://www.virtualbox.org. This file is free software;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * you can redistribute it and/or modify it under the terms of the GNU
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * General Public License (GPL) as published by the Free Software
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Foundation, in version 2 as it comes in the "COPYING" file of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * The contents of this file may alternatively be used under the terms
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * of the Common Development and Distribution License Version 1.0
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * VirtualBox OSE distribution, in which case the provisions of the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * CDDL are applicable instead of those of the GPL.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * You may elect to license modified versions of this file under the
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * terms and conditions of either the GPL or the CDDL or both.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Clara, CA 95054 USA or visit http://www.sun.com if you need
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * additional information or have any questions.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster/** @defgroup grp_rt_rand RTRand - Random Numbers and Byte Streams
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @ingroup grp_rt
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Fills a buffer with random bytes.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param pv Where to store the random bytes.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param cb Number of bytes to generate.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan FosterRTDECL(void) RTRandBytes(void *pv, size_t cb) RT_NO_THROW;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Generate a 32-bit signed random number in the set [i32First..i32Last].
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @returns The random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param i32First First number in the set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param i32Last Last number in the set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan FosterRTDECL(int32_t) RTRandS32Ex(int32_t i32First, int32_t i32Last) RT_NO_THROW;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Generate a 32-bit signed random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @returns The random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Generate a 32-bit unsigned random number in the set [u32First..u32Last].
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @returns The random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param u32First First number in the set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param u32Last Last number in the set.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan FosterRTDECL(uint32_t) RTRandU32Ex(uint32_t u32First, uint32_t u32Last) RT_NO_THROW;
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Generate a 32-bit unsigned random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @returns The random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * Generate a 64-bit signed random number in the set [i64First..i64Last].
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @returns The random number.
a688bcbb4bcff5398fdd29b86f83450257dc0df4Allan Foster * @param i64First First number in the set.