7namespace zypp {
namespace base {
12 static bool init =
false;
17 int fd = open(
"/dev/urandom", O_RDONLY|O_CLOEXEC);
18 if (fd < 0 || ::read(fd, &seed,
sizeof(seed)) !=
sizeof(seed))
22 seed = rand()+time(0);
24 if (fd >= 0) close(fd);
33 if (length <=0 )
return std::string();
35 std::string
str;
str.resize( length );
String related utilities and Regular expression matching.
std::string random_string(int length)
unsigned random()
Return a random number from [0,RAND_MAX[.
Easy-to use interface to the ZYPP dependency resolver.