From e7ca884b3d124ff04ca52f0c6024db4a61e4848c Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 26 Oct 2021 16:30:42 +0000 Subject: [PATCH] Add seed value constructor to DataBuilder This is needed for experimenting with alternate fuzzing frameworks that can generate a seed value without needing to hash the input. Change-Id: I8207fd16c83265268c7e5764b707456e59f79a07 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/67501 Commit-Queue: Ryan Harrison Auto-Submit: Ryan Harrison Kokoro: Kokoro Reviewed-by: Ben Clayton --- fuzzers/data_builder.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fuzzers/data_builder.h b/fuzzers/data_builder.h index 5abb98c4fd..c5b23a650f 100644 --- a/fuzzers/data_builder.h +++ b/fuzzers/data_builder.h @@ -28,12 +28,16 @@ namespace fuzzers { /// Builder for generic pseudo-random data using a data buffer as seed class DataBuilder { public: - /// @brief Initialize random number generations + /// @brief Initialize internal random number generation using data as seed /// @param data - pointer to a data buffer to use as a seed /// @param size - size of data buffer explicit DataBuilder(const uint8_t* data, size_t size) : generator_(data, size) {} + /// @brief Initialize internal random number generation using seed value + /// @param seed - value to use as seed + explicit DataBuilder(uint64_t seed) : generator_(seed) {} + ~DataBuilder() = default; DataBuilder(DataBuilder&&) = default;