Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
worker_thread.h
1#ifndef WORKER_THREAD_H
2#define WORKER_THREAD_H
3
4#include <atomic>
5#include <stdint.h>
6#include <random>
7
8namespace ara
9{
10 namespace exec
11 {
14 {
15 private:
16 static std::atomic_uint64_t mOffset;
17 static thread_local std::default_random_engine mGenerator;
18
19 public:
21 static const uint64_t cOffsetStep = 6;
22
23 WorkerThread() noexcept = default;
24 virtual ~WorkerThread() noexcept = default;
25
28 uint64_t GetRandom() noexcept;
29 };
30 }
31}
32
33#endif
DeterministicClient random number generator.
Definition: worker_thread.h:14
uint64_t GetRandom() noexcept
Generate a unique random number for each container.
Definition: worker_thread.cpp:11
static const uint64_t cOffsetStep
Offset step that WorkerThread takes to generate the next unique random number.
Definition: worker_thread.h:21