| 123456789101112131415161718192021222324252627282930 |
- //
- // thread_safe.h
- // shared_random_generator
- //
- // Created by Sam Jaffe on 3/19/23.
- // Copyright © 2023 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <mutex>
- #include <random/device.h>
- namespace engine::random {
- class ThreadSafeDevice : public Device {
- private:
- std::mutex mutex_;
- std::unique_ptr<Device> impl_;
-
- public:
- ThreadSafeDevice(std::unique_ptr<Device> impl);
-
- unsigned int exclusive(unsigned int max) final;
- double exclusive(double min, double max) final;
- double inclusive(double min, double max) final;
- };
- }
|