| 1 |
//go:build !no_antithesis_sdk |
| 2 |
|
| 3 |
// Package random is part of the [Antithesis Go SDK], which enables Go applications to integrate with the [Antithesis platform]. |
| 4 |
// |
| 5 |
// These functions should not be used to seed a conventional PRNG, and should not have their return values stored and used to make a decision at a later time. Doing either of these things makes it much harder for the Antithesis platform to control the history of your program's execution, and also makes it harder for Antithesis to learn which inputs provided at which times are most fruitful. Instead, you should call a function from the random package every time your program or [workload] needs to make a decision, at the moment that you need to make the decision. |
| 6 |
// |
| 7 |
// These functions are also safe to call outside the Antithesis environment, where they will fall back on values from [crypto/rand]. |
| 8 |
// |
| 9 |
// [Antithesis Go SDK]: https://antithesis.com/docs/using_antithesis/sdk/go/ |
| 10 |
// [Antithesis platform]: https://antithesis.com |
| 11 |
// [workload]: https://antithesis.com/docs/test_templates/first_test |
| 12 |
package random |
| 13 |
|
| 14 |
import ( |
| 15 |
"github.com/antithesishq/antithesis-sdk-go/internal" |
| 16 |
) |
| 17 |
|
| 18 |
// GetRandom returns a uint64 value chosen by Antithesis. You should not store this value or use it to seed a PRNG, but should use it immediately. |
| 19 |
// |
| 20 |
// Deprecated: Use [Source] instead of calling this function directly. |
| 21 |
func GetRandom() uint64 { |
| 22 |
return internal.Get_random() |
| 23 |
} |