Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 260 for rand1 (0.04 sec)

  1. src/sync/map_test.go

    	}
    }
    
    type mapResult struct {
    	value any
    	ok    bool
    }
    
    func randValue(r *rand.Rand) any {
    	b := make([]byte, r.Intn(4))
    	for i := range b {
    		b[i] = 'a' + byte(rand.Intn(26))
    	}
    	return string(b)
    }
    
    func (mapCall) Generate(r *rand.Rand, size int) reflect.Value {
    	c := mapCall{op: mapOps[rand.Intn(len(mapOps))], k: randValue(r)}
    	switch c.op {
    	case opStore, opLoadOrStore:
    		c.v = randValue(r)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 01 15:34:22 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  2. test/ken/chan.go

    // Test communication operations including select.
    
    package main
    
    import "os"
    import "runtime"
    import "sync"
    
    var randx int
    
    func nrand(n int) int {
    	randx += 10007
    	if randx >= 1000000 {
    		randx -= 1000000
    	}
    	return randx % n
    }
    
    type Chan struct {
    	sc, rc chan int // send and recv chan
    	sv, rv int      // send and recv seq
    }
    
    var (
    	nproc      int
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 24 05:24:24 UTC 2012
    - 4.7K bytes
    - Viewed (0)
  3. src/crypto/rsa/pkcs1v15_test.go

    func TestEncryptPKCS1v15(t *testing.T) {
    	random := rand.Reader
    	k := (rsaPrivateKey.N.BitLen() + 7) / 8
    
    	tryEncryptDecrypt := func(in []byte, blind bool) bool {
    		if len(in) > k-11 {
    			in = in[0 : k-11]
    		}
    
    		ciphertext, err := EncryptPKCS1v15(random, &rsaPrivateKey.PublicKey, in)
    		if err != nil {
    			t.Errorf("error encrypting: %s", err)
    			return false
    		}
    
    		var rand io.Reader
    		if !blind {
    			rand = nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 15 00:16:30 UTC 2022
    - 8.6K bytes
    - Viewed (0)
  4. src/math/rand/v2/zipf.go

    // "Rejection-Inversion to Generate Variates
    // from Monotone Discrete Distributions"
    // http://eeyore.wu-wien.ac.at/papers/96-04-04.wh-der.ps.gz
    
    package rand
    
    import "math"
    
    // A Zipf generates Zipf distributed variates.
    type Zipf struct {
    	r            *Rand
    	imax         float64
    	v            float64
    	q            float64
    	s            float64
    	oneminusQ    float64
    	oneminusQinv float64
    	hxm          float64
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 14:29:30 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  5. cmd/dynamic-timeouts_test.go

    func TestDynamicTimeoutConcurrent(t *testing.T) {
    	// Race test.
    	timeout := newDynamicTimeout(time.Second, time.Millisecond)
    	var wg sync.WaitGroup
    	for i := 0; i < runtime.GOMAXPROCS(0); i++ {
    		wg.Add(1)
    		rng := rand.New(rand.NewSource(int64(i)))
    		go func() {
    			defer wg.Done()
    			for i := 0; i < 100; i++ {
    				for j := 0; j < 100; j++ {
    					timeout.LogSuccess(time.Duration(float64(time.Second) * rng.Float64()))
    				}
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Oct 14 10:08:40 UTC 2022
    - 5.4K bytes
    - Viewed (0)
  6. pkg/apis/networking/fuzzer/fuzzer.go

    			boolean := []bool{false, true}
    			is6 := boolean[c.Rand.Intn(2)]
    			ip := generateRandomIP(is6, c)
    			obj.Name = ip
    		},
    		func(obj *networking.ServiceCIDR, c fuzz.Continue) {
    			c.FuzzNoCustom(obj) // fuzz self without calling this function again
    			boolean := []bool{false, true}
    
    			is6 := boolean[c.Rand.Intn(2)]
    			primary := generateRandomCIDR(is6, c)
    			obj.Spec.CIDRs = []string{primary}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Oct 31 21:05:06 UTC 2023
    - 4K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/runtime/serializer/encoder_with_allocator_test.go

    			obj: func() runtime.Object {
    				carpPayload := make([]byte, 1000) // 1 kB
    				if _, err := rand.Read(carpPayload); err != nil {
    					panic(err)
    				}
    				return carpWithPayload(carpPayload)
    			}(),
    		},
    		{
    			name: "an obj with 10kB payload",
    			obj: func() runtime.Object {
    				carpPayload := make([]byte, 10000) // 10 kB
    				if _, err := rand.Read(carpPayload); err != nil {
    					panic(err)
    				}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Feb 23 13:38:29 UTC 2022
    - 3.6K bytes
    - Viewed (0)
  8. src/crypto/rsa/equal_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package rsa_test
    
    import (
    	"crypto"
    	"crypto/rand"
    	"crypto/rsa"
    	"crypto/x509"
    	"testing"
    )
    
    func TestEqual(t *testing.T) {
    	private, _ := rsa.GenerateKey(rand.Reader, 512)
    	public := &private.PublicKey
    
    	if !public.Equal(public) {
    		t.Errorf("public key is not equal to itself: %v", public)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 05 18:05:10 UTC 2020
    - 1.3K bytes
    - Viewed (0)
  9. test/stress/maps.go

    type intMap map[int][]byte
    
    func (m intMap) AddItem() {
    	s0 := len(m)
    	for len(m) == s0 {
    		key := rand.Intn(s0 + 1)
    		m[key] = make([]byte, rand.Intn(64<<10))
    	}
    }
    
    func (m intMap) DelItem() {
    	for k := range m {
    		delete(m, k)
    		return
    	}
    }
    
    func (m intMap) GetItem() {
    	key := rand.Intn(len(m))
    	if s, ok := m[key]; ok {
    		copy(s, deadcafe)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 02 13:43:18 UTC 2016
    - 1.8K bytes
    - Viewed (0)
  10. src/crypto/dsa/dsa_test.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package dsa
    
    import (
    	"crypto/rand"
    	"math/big"
    	"testing"
    )
    
    func testSignAndVerify(t *testing.T, i int, priv *PrivateKey) {
    	hashed := []byte("testing")
    	r, s, err := Sign(rand.Reader, priv, hashed)
    	if err != nil {
    		t.Errorf("%d: error signing: %s", i, err)
    		return
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 15 21:04:43 UTC 2019
    - 4.7K bytes
    - Viewed (0)
Back to top