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 <rharrison@chromium.org> Auto-Submit: Ryan Harrison <rharrison@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
6c4effe654
commit
e7ca884b3d
|
@ -28,12 +28,16 @@ namespace fuzzers {
|
||||||
/// Builder for generic pseudo-random data using a data buffer as seed
|
/// Builder for generic pseudo-random data using a data buffer as seed
|
||||||
class DataBuilder {
|
class DataBuilder {
|
||||||
public:
|
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 data - pointer to a data buffer to use as a seed
|
||||||
/// @param size - size of data buffer
|
/// @param size - size of data buffer
|
||||||
explicit DataBuilder(const uint8_t* data, size_t size)
|
explicit DataBuilder(const uint8_t* data, size_t size)
|
||||||
: generator_(data, 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() = default;
|
||||||
DataBuilder(DataBuilder&&) = default;
|
DataBuilder(DataBuilder&&) = default;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue