[tests] Make random seed logged and settable (John Newbery)
Pull request description:
This allows tests which use randomness to be reproducibly run on
failure.
https://github.com/bitcoin/bitcoin/pull/15963/files
---
Depends on D7081
Backport of Core [[https://github.com/bitcoin/bitcoin/pull/15963 | PR15963]]