pinocchio  3.4.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
string-generator.hpp
1 //
2 // Copyright (c) 2016-2019 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_utils_string_generator_hpp__
6 #define __pinocchio_utils_string_generator_hpp__
7 
8 #include <string>
9 #include <cstdlib>
10 
11 namespace pinocchio
12 {
13 
21  inline std::string randomStringGenerator(const int len)
22  {
23  std::string res;
24  static const char alphanum[] = "0123456789"
25  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
26  "abcdefghijklmnopqrstuvwxyz";
27 
28  for (int i = 0; i < len; ++i)
29  res += alphanum[((size_t)std::rand() % (sizeof(alphanum) - 1))];
30  return res;
31  }
32 } // namespace pinocchio
33 
34 #endif // __pinocchio_utils_string_generator_hpp__
Main pinocchio namespace.
Definition: treeview.dox:11
std::string randomStringGenerator(const int len)
Generate a random string composed of alphanumeric symbols of a given length.