proxygen
RandomGenerator.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <sodium/randombytes.h>
12 #include <array>
13 
14 namespace fizz {
15 
16 template <size_t Size>
21  std::array<uint8_t, Size> generateRandom() {
22  std::array<uint8_t, Size> random;
23  randombytes_buf(random.data(), Size);
24  return random;
25  }
26 };
27 
34  T random;
35  randombytes_buf(&random, sizeof(random));
36  return random;
37  }
38 };
39 } // namespace fizz
#define T(v)
Definition: http_parser.c:233
Integral2 random(Integral1 low, Integral2 up)
std::array< uint8_t, Size > generateRandom()
Definition: Actions.h:16
static const char *const value
Definition: Conv.cpp:50