MCPcopy Create free account
hub / github.com/devfile/api / GetRandomDecision

Function GetRandomDecision

test/v200/utils/common/test_utils.go:289–291  ·  view source on GitHub ↗

GetRandomDecision randomly returns true or false, but weighted to one or the other. For example if success is set to 2 and failure to 1, true is twice as likely to be returned.

(success int, failure int)

Source from the content-addressed store, hash-verified

287// GetRandomDecision randomly returns true or false, but weighted to one or the other.
288// For example if success is set to 2 and failure to 1, true is twice as likely to be returned.
289func GetRandomDecision(success int, failure int) bool {
290 return rand.Intn(success+failure) > failure-1
291}
292
293// GetRandomNumber randomly returns an integer between 1 and the number specified.
294func GetRandomNumber(min int, max int) int {

Callers 10

SetExecCommandValuesMethod · 0.85
SetApplyCommandValuesMethod · 0.85
GetBinaryDecisionFunction · 0.85
SetEventsValuesMethod · 0.85
setPropertyFunction · 0.85
setMetaDataValuesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected