dune-vtk 2.12
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::Vtk
9{
10 inline std::string uid (std::size_t len = 8)
11 {
12 static const auto digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
13 static const int N = std::strlen(digits);
14
15 std::string id(len,' ');
16 for (std::size_t i = 0; i < len; ++i)
17 id[i] = digits[std::rand()%N];
18
19 return id;
20 }
21
22} // end namespace Dune::Vtk
Definition writer.hh:16
std::string uid(std::size_t len=8)
Definition uid.hh:10
int id()
static constexpr size_type N()
T rand(T... args)
T strlen(T... args)