MCPcopy
hub / github.com/brianvoe/gofakeit / randomInt

Function randomInt

number.go:281–290  ·  view source on GitHub ↗
(f *Faker, i []int)

Source from the content-addressed store, hash-verified

279func (f *Faker) RandomInt(i []int) int { return randomInt(f, i) }
280
281func randomInt(f *Faker, i []int) int {
282 size := len(i)
283 if size == 0 {
284 return 0
285 }
286 if size == 1 {
287 return i[0]
288 }
289 return i[f.IntN(size)]
290}
291
292// RandomUint will take in a slice of uint and return a randomly selected value
293func RandomUint(u []uint) uint { return randomUint(GlobalFaker, u) }

Callers 3

RandomIntFunction · 0.85
RandomIntMethod · 0.85
addNumberLookupFunction · 0.85

Calls 1

IntNMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…