Skip to content

Commit

Permalink
add RandomNumberGenerator::random_array<>()
Browse files Browse the repository at this point in the history
  • Loading branch information
reneme committed Jun 27, 2024
1 parent 66216e1 commit 5b1f623
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/rng/rng.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ class BOTAN_PUBLIC_API(2, 0) RandomNumberGenerator {
return result;
}

/**
* Create a std::array of @p bytes random bytes
*/
template <size_t bytes>
std::array<uint8_t, bytes> random_array() {
std::array<uint8_t, bytes> result;
random_vec(result);
return result;
}

/**
* Return a random byte
* @return random byte
Expand Down

0 comments on commit 5b1f623

Please sign in to comment.