Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for randInt (0.23 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/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)
  3. 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)
  4. 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)
  5. src/runtime/rand.go

    	lock  mutex
    	seed  [32]byte
    	state chacha8rand.State
    	init  bool
    }
    
    var readRandomFailed bool
    
    // randinit initializes the global random state.
    // It must be called before any use of grand.
    func randinit() {
    	lock(&globalRand.lock)
    	if globalRand.init {
    		fatal("randinit twice")
    	}
    
    	seed := &globalRand.seed
    	if startupRand != nil {
    		for i, c := range startupRand {
    			seed[i%len(seed)] ^= c
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 14:32:47 UTC 2024
    - 8K bytes
    - Viewed (0)
  6. src/internal/fuzz/pcg.go

    	return r
    }
    
    func (r *pcgRand) step() {
    	r.state *= multiplier
    	r.state += r.inc
    }
    
    func (r *pcgRand) save(randState, randInc *uint64) {
    	*randState = r.state
    	*randInc = r.inc
    }
    
    func (r *pcgRand) restore(randState, randInc uint64) {
    	r.state = randState
    	r.inc = randInc
    }
    
    // uint32 returns a pseudo-random uint32.
    func (r *pcgRand) uint32() uint32 {
    	x := r.state
    	r.step()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:28:14 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  7. src/sync/pool.go

    	// Prevents false sharing on widespread platforms with
    	// 128 mod (cache line size) = 0 .
    	pad [128 - unsafe.Sizeof(poolLocalInternal{})%128]byte
    }
    
    // from runtime
    //
    //go:linkname runtime_randn runtime.randn
    func runtime_randn(n uint32) uint32
    
    var poolRaceHash [128]uint64
    
    // poolRaceAddr returns an address to use as the synchronization point
    // for race detector logic. We don't use the actual pointer stored in x
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jun 07 21:14:51 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  8. tensorflow/compiler/mlir/quantization/stablehlo/python/integration_test/quantize_model_test_base.py

            """Initializes a GatherModel.
    
            Args:
              use_variable: If True, creates a variable for weight.
            """
            super().__init__()
            w_val = np.random.randn(128, 32).astype('f4')
            if use_variable:
              self.w = variables.Variable(w_val)
            else:
              self.w = w_val
    
          @def_function.function(
              input_signature=[
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Tue May 14 06:31:57 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  9. cmd/test-utils_test.go

    }
    
    // nextSuffix - provides a new unique suffix every time the function is called.
    func nextSuffix() string {
    	randmu.Lock()
    	r := randN
    	// Initial seed required, generate one.
    	if r == 0 {
    		r = reseed()
    	}
    	// constants from Numerical Recipes
    	r = r*1664525 + 1013904223
    	randN = r
    	randmu.Unlock()
    	return strconv.Itoa(int(1e9 + r%1e9))[1:]
    }
    
    // isSameType - compares two object types via reflect.TypeOf
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Mon Jun 10 15:50:49 UTC 2024
    - 76.9K bytes
    - Viewed (0)
  10. cmd/iam.go

    	//
    	//    - if baseInterval=10m, then 5m <= waitInterval() < 15m
    	waitInterval := func() time.Duration {
    		// Calculate a random value such that 0 <= value < baseInterval
    		randAmt := time.Duration(r.Float64() * float64(baseInterval))
    		return baseInterval/2 + randAmt
    	}
    
    	timer := time.NewTimer(waitInterval())
    	defer timer.Stop()
    
    	for {
    		select {
    		case <-timer.C:
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Thu Jun 13 22:26:38 UTC 2024
    - 71.9K bytes
    - Viewed (0)
Back to top