dune-vtk 2.8
Loading...
Searching...
No Matches
uid.hh
Go to the documentation of this file.
1#pragma once
2
3#include <cstdlib>
4#include <cstring>
5#include <ctime>
6#include <string>
7
8namespace Dune
9{
10 namespace Vtk
11 {
12 inline std::string uid (std::size_t len = 8)
13 {
14 static const auto digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
15 static const int N = std::strlen(digits);
16
17 std::string id(len,' ');
18 for (std::size_t i = 0; i < len; ++i)
19 id[i] = digits[std::rand()%N];
20
21 return id;
22 }
23
24 } // end namespace Vtk
25} // end namespace Dune
Definition: writer.hh:13
std::string uid(std::size_t len=8)
Definition: uid.hh:12