VirtualBox

Changeset 889 in vbox


Ignore:
Timestamp:
Feb 14, 2007 9:33:52 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18606
Message:

RTRand API.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/rand.h

    r839 r889  
    11/** @file
    2  * InnoTek Portable Runtime - Memory Allocation.
     2 * InnoTek Portable Runtime - Random Numbers and Byte Streams.
    33 */
    44
     
    1919 */
    2020
    21 #ifndef __iprt_alloc_h__
    22 #define __iprt_alloc_h__
     21#ifndef __iprt_rand_h__
     22#define __iprt_rand_h__
    2323
    24 /* Forwarding to the canonical header. */
    25 #include <iprt/mem.h>
     24#include <iprt/cdefs.h>
     25#include <iprt/types.h>
     26
     27__BEGIN_DECLS
     28
     29/** @defgroup grp_rt_rand       RTRand - Random Numbers and Byte Streams
     30 * @ingroup grp_rt
     31 * @{
     32 */
     33
     34/**
     35 * Fills a buffer with random bytes.
     36 *
     37 * @param   pv  Where to store the random bytes.
     38 * @param   cb  Number of bytes to generate.
     39 */
     40RTDECL(void) RTRandBytes(void *pv, size_t cb);
     41
     42/**
     43 * Generate a 32-bit signed random number in the set [i32First..i32Last].
     44 *
     45 * @returns The random number.
     46 * @param   i32First    First number in the set.
     47 * @param   i32Last     Last number in the set.
     48 */
     49RTDECL(int32_t) RTRandS32Ex(int32_t i32First, int32_t i32Last);
     50
     51/**
     52 * Generate a 32-bit signed random number.
     53 *
     54 * @returns The random number.
     55 */
     56RTDECL(int32_t) RTRandS32(void);
     57
     58/**
     59 * Generate a 32-bit unsigned random number in the set [u32First..u32Last].
     60 *
     61 * @returns The random number.
     62 * @param   u32First    First number in the set.
     63 * @param   u32Last     Last number in the set.
     64 */
     65RTDECL(uint32_t) RTRandU32Ex(uint32_t u32First, uint32_t u32Last);
     66
     67/**
     68 * Generate a 32-bit unsigned random number.
     69 *
     70 * @returns The random number.
     71 */
     72RTDECL(uint32_t) RTRandU32(void);
     73
     74/**
     75 * Generate a 32-bit signed random number in the set [i32First..i32Last].
     76 *
     77 * @returns The random number.
     78 * @param   i32First    First number in the set.
     79 * @param   i32Last     Last number in the set.
     80 */
     81RTDECL(int64_t) RTRandS64Ex(int64_t i64First, int64_t i64Last);
     82
     83/**
     84 * Generate a 64-bit signed random number.
     85 *
     86 * @returns The random number.
     87 */
     88RTDECL(int64_t) RTRandS64(void);
     89
     90/**
     91 * Generate a 64-bit unsigned random number in the set [u64First..u64Last].
     92 *
     93 * @returns The random number.
     94 * @param   u64First    First number in the set.
     95 * @param   u64Last     Last number in the set.
     96 */
     97RTDECL(uint64_t) RTRandU64Ex(uint64_t u64First, uint64_t u64Last);
     98
     99/**
     100 * Generate a 64-bit unsigned random number.
     101 *
     102 * @returns The random number.
     103 */
     104RTDECL(uint64_t) RTRandU64(void);
     105
     106/** @} */
     107
     108__END_DECLS
     109
    26110
    27111#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette