summaryrefslogtreecommitdiff
path: root/include/random.hpp
AgeCommit message (Collapse)AuthorFilesLines
2022-02-09Enable readability-avoid-const-params-in-declsEd Tanous1-1/+1
This check involves explicitly declaring variables const when they're declared auto, which helps in readability, and makes it more clear that the variables are const. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I71198ea03850384a389a56ad26f2c4a48c75b148
2021-05-12Make OpenSSLGenerator max() and min() constexprEd Tanous1-2/+2
The latest version of gcc seems to be enforcing that these are static and constexpr, presumably because std::random_device is now using them in a constexpr context. It seems odd this would be required (you'd think it would be breaking backward compatibility) but it's an easy enough change to make. Tested: Only tested that code builds. Not tested functionally. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3f5e7077d56178fbc7b4e02f4e2f4a357c928c5b
2020-10-09Move Openssl GeneratorEd Tanous1-0/+46
This commit moves the openssl random number generator into its own file, so it can be used in EventService, and moves it to its own file. Seeding a random number generator with time is bad practice in general, so much so that there's a CERT rule about it as well as a clang-tidy check. https://clang.llvm.org/extra/clang-tidy/checks/cert-msc51-cpp.html This doesn't matter much in this case, as we're generating a randomized int for an ID, but it will matter in other cases, and we'd like to have the check on to verify that. Change-Id: I8e6aebb7962d259045ffd558eea22f07f9c23821 Signed-off-by: Ed Tanous <ed@tanous.net>