File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -589,15 +589,18 @@ uint256 FastRandomContext::rand256() noexcept
589
589
return ret;
590
590
}
591
591
592
- std::vector<unsigned char > FastRandomContext::randbytes (size_t len)
592
+ template <typename B>
593
+ std::vector<B> FastRandomContext::randbytes (size_t len)
593
594
{
594
595
if (requires_seed) RandomSeed ();
595
- std::vector<unsigned char > ret (len);
596
+ std::vector<B > ret (len);
596
597
if (len > 0 ) {
597
- rng.Keystream (ret.data (), len);
598
+ rng.Keystream (UCharCast ( ret.data () ), len);
598
599
}
599
600
return ret;
600
601
}
602
+ template std::vector<unsigned char > FastRandomContext::randbytes (size_t );
603
+ template std::vector<std::byte> FastRandomContext::randbytes (size_t );
601
604
602
605
void FastRandomContext::fillrand (Span<std::byte> output)
603
606
{
Original file line number Diff line number Diff line change @@ -211,7 +211,8 @@ class FastRandomContext
211
211
}
212
212
213
213
/* * Generate random bytes. */
214
- std::vector<unsigned char > randbytes (size_t len);
214
+ template <typename B = unsigned char >
215
+ std::vector<B> randbytes (size_t len);
215
216
216
217
/* * Fill a byte Span with random bytes. */
217
218
void fillrand (Span<std::byte> output);
You can’t perform that action at this time.
0 commit comments