VirtualBox

source: vbox/trunk/include/iprt/rand.h@ 1890

Last change on this file since 1890 was 889, checked in by vboxsync, 18 years ago

RTRand API.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/** @file
2 * InnoTek Portable Runtime - Random Numbers and Byte Streams.
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21#ifndef __iprt_rand_h__
22#define __iprt_rand_h__
23
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
110
111#endif
112
Note: See TracBrowser for help on using the repository browser.

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