Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for randInt (0.18 sec)

  1. 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)
  2. 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)
  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)
  6. 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)
  7. 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)
  8. src/internal/fuzz/mem.go

    	// May be reset by coordinator.
    	count int64
    
    	// valueLen is the number of bytes in region which should be read.
    	valueLen int
    
    	// randState and randInc hold the state of a pseudo-random number generator.
    	randState, randInc uint64
    
    	// rawInMem is true if the region holds raw bytes, which occurs during
    	// minimization. If true after the worker fails during minimization, this
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 28 03:44:27 UTC 2022
    - 4.5K bytes
    - Viewed (0)
  9. src/internal/fuzz/worker.go

    	if args.Timeout != 0 {
    		var cancel func()
    		ctx, cancel = context.WithTimeout(ctx, args.Timeout)
    		defer cancel()
    	}
    	mem := <-ws.memMu
    	ws.m.r.save(&mem.header().randState, &mem.header().randInc)
    	defer func() {
    		resp.Count = mem.header().count
    		ws.memMu <- mem
    	}()
    	if args.Limit > 0 && mem.header().count >= args.Limit {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 37.7K bytes
    - Viewed (0)
  10. 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)
Back to top