KVM: selftests: Provide an API for getting a random bool from an RNG
authorSean Christopherson <seanjc@google.com>
Thu, 14 Mar 2024 18:54:55 +0000 (11:54 -0700)
committerSean Christopherson <seanjc@google.com>
Mon, 29 Apr 2024 19:50:42 +0000 (12:50 -0700)
commit73369acd9fbdf6cbf3029cace886abcc626f46ad
treebf1452726af1fc9e564e86c6e9ec1887b6da4296
parentcb6c6914788f65efc8efa72b8a582e2aa2ccc386
KVM: selftests: Provide an API for getting a random bool from an RNG

Move memstress' random bool logic into common code to avoid reinventing
the wheel for basic yes/no decisions.  Provide an outer wrapper to handle
the basic/common case of just wanting a 50/50 chance of something
happening.

Link: https://lore.kernel.org/r/20240314185459.2439072-3-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/test_util.h
tools/testing/selftests/kvm/lib/memstress.c