- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for Intn (0.03 sec)
-
internal/grid/benchmark_test.go
n := 0 var latency int64 managers := grid.Managers hosts := grid.Hosts for pb.Next() { // Pick a random manager. src, dst := rng.Intn(len(managers)), rng.Intn(len(managers)) if src == dst { dst = (dst + 1) % len(managers) } local := managers[src] conn := local.Connection(hosts[dst]) if conn == nil {
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Jun 07 15:51:52 UTC 2024 - 15.7K bytes - Viewed (0) -
cmd/local-locker_test.go
} // Expire 50% expired := time.Now().Add(-time.Hour * 2) for _, v := range l.lockMap { for i := range v { if rng.Intn(2) == 0 { v[i].TimeLastRefresh = expired.UnixNano() } } } start = time.Now() l.expireOldLocks(time.Hour)
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Wed Jul 24 10:24:01 UTC 2024 - 11.9K bytes - Viewed (0) -
src/bytes/buffer_test.go
var buf Buffer s := "" for i := 0; i < 50; i++ { wlen := rand.Intn(len(testString)) if i%2 == 0 { s = fillString(t, "TestMixedReadsAndWrites (1)", &buf, s, 1, testString[0:wlen]) } else { s = fillBytes(t, "TestMixedReadsAndWrites (1)", &buf, s, 1, testBytes[0:wlen]) } rlen := rand.Intn(len(testString)) fub := make([]byte, rlen) n, _ := buf.Read(fub) s = s[n:] }
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Tue Sep 03 20:55:15 UTC 2024 - 18.6K bytes - Viewed (0) -
src/bufio/bufio_test.go
} // While not recommended, it is valid to append to a shifted buffer. // This forces Write to copy the input. if rn.Intn(8) == 0 && cap(b) > 0 { b = b[1:1:cap(b)] } // Append a random integer of varying width. n := int64(rn.Intn(1 << rn.Intn(30))) want = append(strconv.AppendInt(want, n, 10), ' ') b = append(strconv.AppendInt(b, n, 10), ' ') w.Write(b) } w.Flush()
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Fri Nov 01 21:52:12 UTC 2024 - 51.6K bytes - Viewed (0) -
src/bytes/bytes_test.go
} } } var makeFieldsInput = func() []byte { x := make([]byte, 1<<20) // Input is ~10% space, ~10% 2-byte UTF-8, rest ASCII non-space. for i := range x { switch rand.Intn(10) { case 0: x[i] = ' ' case 1: if i > 0 && x[i-1] == 'x' { copy(x[i-1:], "χ") break } fallthrough default: x[i] = 'x' } } return x
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Mon Aug 19 19:09:04 UTC 2024 - 61.2K bytes - Viewed (0) -
cmd/test-utils_test.go
// fetches a random number between range min-max. func getRandomRange(min, max int, seed int64) int { // special value -1 means no explicit seeding. if seed != -1 { rand.Seed(seed) } return rand.Intn(max-min) + min } // Randomizes the order of bytes in the byte array // using Knuth Fisher-Yates shuffle algorithm. func randomizeBytes(s []byte, seed int64) []byte {
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Tue Oct 01 22:13:18 UTC 2024 - 77K bytes - Viewed (0) -
cmd/object-api-multipart_test.go
t.Fatalf("%s : %s", instanceType, err.Error()) } z := obj.(*erasureServerPools) er := z.serverPools[0].sets[0] erasureDisks := er.getDisks() ridx := rand.Intn(len(erasureDisks)) z.serverPools[0].erasureDisksMu.Lock() er.getDisks = func() []StorageAPI { erasureDisks[ridx] = newNaughtyDisk(erasureDisks[ridx], nil, errFaultyDisk) return erasureDisks }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 09:42:21 UTC 2024 - 88.8K bytes - Viewed (0) -
cmd/object-api-utils.go
rng := rand.New(rand.NewSource(time.Now().UTC().UnixNano())) var d net.Dialer var retry int for retry < len(hosts) { ctx, cancel := context.WithTimeout(GlobalContext, 300*time.Millisecond) host = hosts[rng.Intn(len(hosts))] conn, err := d.DialContext(ctx, "tcp", host) cancel() if err != nil { retry++ continue } conn.Close() break } return host }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Thu Aug 08 15:29:58 UTC 2024 - 37.1K bytes - Viewed (0)