Add function for generating a random trust value in unit tests:
- Also use it in some existing code