From 17e1aa981b6713e6fa42870fdd3a6d46586b24da Mon Sep 17 00:00:00 2001 From: Malcolm Keyes <3.malcolmk@gmail.com> Date: Wed, 24 Feb 2021 18:58:13 -0500 Subject: [PATCH] added random_device to intarray.cpp --- .../cryptography/key_distribution/cpp/IntArray.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qapi/protocols/cryptography/key_distribution/cpp/IntArray.cpp b/qapi/protocols/cryptography/key_distribution/cpp/IntArray.cpp index f636ae8..583ff59 100644 --- a/qapi/protocols/cryptography/key_distribution/cpp/IntArray.cpp +++ b/qapi/protocols/cryptography/key_distribution/cpp/IntArray.cpp @@ -25,7 +25,14 @@ class IntArray { // Allocates new memory so must be freed int* random_array = new int[size]; for (int i = 0; i < size; i++) { - random_array[i] = rand() % 2; + try + { + std::random_device rd; + random_array[i] = rd() % 2; + } catch(...) + { + random_array[i] = rand() % 2; + } } return random_array; }