| 12345678910111213141516171819202122232425262728293031323334 |
- //
- // tape.hpp
- // shared_random_generator
- //
- // Created by Sam Jaffe on 3/19/23.
- // Copyright © 2023 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <utility>
- #include <vector>
- #include <random/device.h>
- namespace engine::random {
- class Tape : public Device {
- public:
- // Allow for the serialization and de-serialization of this Tape
- using serial_type = std::vector<result_type>;
- private:
- size_t index_{0}; // transient
- std::vector<result_type> entries_;
- public:
- Tape() = default;
- Tape(serial_type serial) : entries_(std::move(serial)) {}
- explicit operator serial_type() const { return entries_; }
- result_type operator()() override;
- result_type operator()(result_type result);
- };
- }
|