Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 630 for prand (1.87 sec)

  1. src/math/big/alias_test.go

    package big_test
    
    import (
    	cryptorand "crypto/rand"
    	"math/big"
    	"math/rand"
    	"reflect"
    	"testing"
    	"testing/quick"
    )
    
    func equal(z, x *big.Int) bool {
    	return z.Cmp(x) == 0
    }
    
    type bigInt struct {
    	*big.Int
    }
    
    func generatePositiveInt(rand *rand.Rand, size int) *big.Int {
    	n := big.NewInt(1)
    	n.Lsh(n, uint(rand.Intn(size*8)))
    	n.Rand(rand, n)
    	return n
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 19 15:49:05 UTC 2022
    - 8.8K bytes
    - Viewed (0)
  2. src/crypto/rand/util_test.go

    // license that can be found in the LICENSE file.
    
    package rand_test
    
    import (
    	"bytes"
    	"crypto/rand"
    	"fmt"
    	"io"
    	"math/big"
    	mathrand "math/rand"
    	"testing"
    	"time"
    )
    
    // https://golang.org/issue/6849.
    func TestPrimeSmall(t *testing.T) {
    	for n := 2; n < 10; n++ {
    		p, err := rand.Prime(rand.Reader, n)
    		if err != nil {
    			t.Fatalf("Can't generate %d-bit prime: %v", n, err)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 01:35:39 UTC 2022
    - 3.5K bytes
    - Viewed (0)
  3. src/internal/fuzz/mutators_byteslice.go

    		return nil
    	}
    	src := m.rand(len(b))
    	dst := m.rand(len(b))
    	for dst == src {
    		dst = m.rand(len(b))
    	}
    	b[src], b[dst] = b[dst], b[src]
    	return b
    }
    
    // byteSliceArithmeticUint8 adds/subtracts from a random byte in b.
    func byteSliceArithmeticUint8(m *mutator, b []byte) []byte {
    	if len(b) == 0 {
    		return nil
    	}
    	pos := m.rand(len(b))
    	v := byte(m.rand(35) + 1)
    	if m.r.bool() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 19 18:23:43 UTC 2021
    - 7.7K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/server/filters/goaway.go

    limitations under the License.
    */
    
    package filters
    
    import (
    	"math/rand"
    	"net/http"
    	"sync"
    )
    
    // GoawayDecider decides if server should send a GOAWAY
    type GoawayDecider interface {
    	Goaway(r *http.Request) bool
    }
    
    var (
    	// randPool used to get a rand.Rand and generate a random number thread-safely,
    	// which improve the performance of using rand.Rand with a locker
    	randPool = &sync.Pool{
    		New: func() interface{} {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sun Jun 28 20:27:28 UTC 2020
    - 2.4K bytes
    - Viewed (0)
  5. src/math/rand/v2/example_test.go

    }
    
    func ExamplePerm() {
    	for _, value := range rand.Perm(3) {
    		fmt.Println(value)
    	}
    
    	// Unordered output: 1
    	// 2
    	// 0
    }
    
    func ExampleN() {
    	// Print an int64 in the half-open interval [0, 100).
    	fmt.Println(rand.N(int64(100)))
    
    	// Sleep for a random duration between 0 and 100 milliseconds.
    	time.Sleep(rand.N(100 * time.Millisecond))
    }
    
    func ExampleShuffle() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 30 17:09:26 UTC 2023
    - 4.4K bytes
    - Viewed (0)
  6. platforms/ide/ide/src/test/groovy/org/gradle/plugins/ide/internal/tooling/BuildInvocationsBuilderTest.groovy

        def setupSpec() {
            // create a project/task tree:
            //   root (t1, t2)
            //   +--- child 1 (t2, t3)
            //        +-- grand child (t3, t4)
            //        +-- grand child (t4)
    
            // root tasks (one public, one private)
            def task1OfRoot = project.tasks.create('t1', DefaultTask)
            task1OfRoot.group = 'build'
    Registered: Wed Jun 12 18:38:38 UTC 2024
    - Last Modified: Tue Sep 26 14:49:12 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  7. src/crypto/ecdsa/ecdsa_test.go

    	case elliptic.P224().Params():
    		_, _, err := randomPoint(p224(), rand)
    		return err
    	case elliptic.P256().Params():
    		_, _, err := randomPoint(p256(), rand)
    		return err
    	case elliptic.P384().Params():
    		_, _, err := randomPoint(p384(), rand)
    		return err
    	case elliptic.P521().Params():
    		_, _, err := randomPoint(p521(), rand)
    		return err
    	default:
    		panic("unknown curve")
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 21:33:58 UTC 2024
    - 13.5K bytes
    - Viewed (0)
  8. src/math/rand/example_test.go

    	rand.Shuffle(len(numbers), func(i, j int) {
    		numbers[i], numbers[j] = numbers[j], numbers[i]
    		letters[i], letters[j] = letters[j], letters[i]
    	})
    	for i := range numbers {
    		fmt.Printf("%c: %c\n", letters[i], numbers[i])
    	}
    }
    
    func ExampleIntn() {
    	fmt.Println(rand.Intn(100))
    	fmt.Println(rand.Intn(100))
    	fmt.Println(rand.Intn(100))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 26 16:24:57 UTC 2022
    - 4.2K bytes
    - Viewed (0)
  9. src/internal/fuzz/mutator.go

    }
    
    func (m *mutator) rand(n int) int {
    	return m.r.intn(n)
    }
    
    func (m *mutator) randByteOrder() binary.ByteOrder {
    	if m.r.bool() {
    		return binary.LittleEndian
    	}
    	return binary.BigEndian
    }
    
    // chooseLen chooses length of range mutation in range [1,n]. It gives
    // preference to shorter ranges.
    func (m *mutator) chooseLen(n int) int {
    	switch x := m.rand(100); {
    	case x < 90:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 18 20:01:34 UTC 2023
    - 6.6K bytes
    - Viewed (0)
  10. pkg/apis/batch/fuzzer/fuzzer.go

    			}
    		},
    		func(j *batch.JobSpec, c fuzz.Continue) {
    			c.FuzzNoCustom(j) // fuzz self without calling this function again
    			completions := int32(c.Rand.Int31())
    			parallelism := int32(c.Rand.Int31())
    			backoffLimit := int32(c.Rand.Int31())
    			j.Completions = &completions
    			j.Parallelism = &parallelism
    			j.BackoffLimit = &backoffLimit
    			j.ManualSelector = pointer.Bool(c.RandBool())
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Mar 05 17:25:15 UTC 2024
    - 3K bytes
    - Viewed (0)
Back to top