libzypp: zypp/base/Random.h Source File

libzypp 17.36.6

Random.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#ifndef ZYPP_BASE_Random_H
11#define ZYPP_BASE_Random_H
12
13#include <string>
14
16namespace zypp
17{
19 namespace base
20 {
21 // Taken from KApplication
22 int random_int();
23 // Taken from KApplication
24 std::string random_string(int length);
25
26
28 inline unsigned random()
29 {
30 return random_int();
31 }
32
33 inline unsigned random( unsigned size_r )
34 {
35 return random_int() % size_r;
36 }
37
38 inline unsigned random( unsigned min_r, unsigned size_r )
39 {
40 return min_r + random( size_r );
41 }
42
43
44 } //ns base
45} // ns zypp
46
47#endif
48
zypp::base
Definition Random.cc:7
zypp::base::random_string
std::string random_string(int length)
Definition Random.cc:31
zypp::base::random
unsigned random()
Return a random number from [0,RAND_MAX[.
Definition Random.h:28
zypp::base::random_int
int random_int()
Definition Random.cc:10
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20