Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for randIntn (0.14 sec)

  1. src/net/dnsclient.go

    	"golang.org/x/net/dns/dnsmessage"
    )
    
    // provided by runtime
    //
    //go:linkname runtime_rand runtime.rand
    func runtime_rand() uint64
    
    func randInt() int {
    	return int(uint(runtime_rand()) >> 1) // clear sign bit
    }
    
    func randIntn(n int) int {
    	return randInt() % n
    }
    
    // reverseaddr returns the in-addr.arpa. or ip6.arpa. hostname of the IP
    // address addr suitable for rDNS (PTR) record lookup or an error if it fails
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:53 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  2. src/math/big/gcd_test.go

    // This file implements a GCD benchmark.
    // Usage: go test math/big -test.bench GCD
    
    package big
    
    import (
    	"math/rand"
    	"testing"
    )
    
    // randInt returns a pseudo-random Int in the range [1<<(size-1), (1<<size) - 1]
    func randInt(r *rand.Rand, size uint) *Int {
    	n := new(Int).Lsh(intOne, size-1)
    	x := new(Int).Rand(r, n)
    	return x.Add(x, n) // make sure result > 1<<(size-1)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 14 19:11:43 UTC 2016
    - 2.2K bytes
    - Viewed (0)
  3. src/net/dnsclient_unix.go

    	// gets set to true.
    	errServerTemporarilyMisbehaving = &temporaryError{"server misbehaving"}
    )
    
    func newRequest(q dnsmessage.Question, ad bool) (id uint16, udpReq, tcpReq []byte, err error) {
    	id = uint16(randInt())
    	b := dnsmessage.NewBuilder(make([]byte, 2, 514), dnsmessage.Header{ID: id, RecursionDesired: true, AuthenticData: ad})
    	if err := b.StartQuestions(); err != nil {
    		return 0, nil, nil, err
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Apr 14 18:23:45 UTC 2024
    - 24.5K bytes
    - Viewed (0)
  4. src/math/big/int_test.go

    			benchmarkIntSqr(b, n)
    		})
    	}
    }
    
    func benchmarkDiv(b *testing.B, aSize, bSize int) {
    	var r = rand.New(rand.NewSource(1234))
    	aa := randInt(r, uint(aSize))
    	bb := randInt(r, uint(bSize))
    	if aa.Cmp(bb) < 0 {
    		aa, bb = bb, aa
    	}
    	x := new(Int)
    	y := new(Int)
    
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		x.DivMod(aa, bb, y)
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 58.5K bytes
    - Viewed (0)
  5. cmd/server_test.go

    	// generate a random number between 13 and 200.
    	randInt := getRandomRange(13, 200, -1)
    	// write into buffer till length of the buffer is greater than the generated random number.
    	for i := 0; i <= randInt; i += 10 {
    		buffer.WriteString(data)
    	}
    	// String content which is used for put object range test.
    	putBytes := buffer.Bytes()
    	putBytes = putBytes[:randInt]
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri May 24 23:05:23 UTC 2024
    - 115.3K bytes
    - Viewed (0)
Back to top