VirtualBox

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

Last change on this file since 6175 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/** @file
2 * innotek Portable Runtime - Random Numbers and Byte Streams.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek 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 (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_rand_h
27#define ___iprt_rand_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32__BEGIN_DECLS
33
34/** @defgroup grp_rt_rand RTRand - Random Numbers and Byte Streams
35 * @ingroup grp_rt
36 * @{
37 */
38
39/**
40 * Fills a buffer with random bytes.
41 *
42 * @param pv Where to store the random bytes.
43 * @param cb Number of bytes to generate.
44 */
45RTDECL(void) RTRandBytes(void *pv, size_t cb);
46
47/**
48 * Generate a 32-bit signed random number in the set [i32First..i32Last].
49 *
50 * @returns The random number.
51 * @param i32First First number in the set.
52 * @param i32Last Last number in the set.
53 */
54RTDECL(int32_t) RTRandS32Ex(int32_t i32First, int32_t i32Last);
55
56/**
57 * Generate a 32-bit signed random number.
58 *
59 * @returns The random number.
60 */
61RTDECL(int32_t) RTRandS32(void);
62
63/**
64 * Generate a 32-bit unsigned random number in the set [u32First..u32Last].
65 *
66 * @returns The random number.
67 * @param u32First First number in the set.
68 * @param u32Last Last number in the set.
69 */
70RTDECL(uint32_t) RTRandU32Ex(uint32_t u32First, uint32_t u32Last);
71
72/**
73 * Generate a 32-bit unsigned random number.
74 *
75 * @returns The random number.
76 */
77RTDECL(uint32_t) RTRandU32(void);
78
79/**
80 * Generate a 32-bit signed random number in the set [i32First..i32Last].
81 *
82 * @returns The random number.
83 * @param i32First First number in the set.
84 * @param i32Last Last number in the set.
85 */
86RTDECL(int64_t) RTRandS64Ex(int64_t i64First, int64_t i64Last);
87
88/**
89 * Generate a 64-bit signed random number.
90 *
91 * @returns The random number.
92 */
93RTDECL(int64_t) RTRandS64(void);
94
95/**
96 * Generate a 64-bit unsigned random number in the set [u64First..u64Last].
97 *
98 * @returns The random number.
99 * @param u64First First number in the set.
100 * @param u64Last Last number in the set.
101 */
102RTDECL(uint64_t) RTRandU64Ex(uint64_t u64First, uint64_t u64Last);
103
104/**
105 * Generate a 64-bit unsigned random number.
106 *
107 * @returns The random number.
108 */
109RTDECL(uint64_t) RTRandU64(void);
110
111/** @} */
112
113__END_DECLS
114
115
116#endif
117
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