Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 42 for rand1 (0.11 sec)

  1. src/runtime/rand.go

    	mp.chacha8.Init64(seed)
    	mp.cheaprand = rand()
    }
    
    // randn is like rand() % n but faster.
    // Do not change signature: used via linkname from other packages.
    //
    //go:nosplit
    //go:linkname randn
    func randn(n uint32) uint32 {
    	// See https://lemire.me/blog/2016/06/27/a-fast-alternative-to-the-modulo-reduction/
    	return uint32((uint64(uint32(rand())) * uint64(n)) >> 32)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 14:32:47 UTC 2024
    - 8K bytes
    - Viewed (0)
  2. cmd/erasure-common.go

    package cmd
    
    import (
    	"context"
    	"fmt"
    	"io"
    	"math/rand"
    	"sync"
    	"time"
    
    	"github.com/minio/pkg/v3/sync/errgroup"
    )
    
    func (er erasureObjects) getOnlineDisks() (newDisks []StorageAPI) {
    	disks := er.getDisks()
    	var wg sync.WaitGroup
    	var mu sync.Mutex
    	r := rand.New(rand.NewSource(time.Now().UnixNano()))
    	for _, i := range r.Perm(len(disks)) {
    		i := i
    		wg.Add(1)
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri May 24 23:05:23 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  3. src/internal/trace/mud_test.go

    // license that can be found in the LICENSE file.
    
    package trace
    
    import (
    	"math"
    	"math/rand"
    	"testing"
    )
    
    func TestMUD(t *testing.T) {
    	// Insert random uniforms and check histogram mass and
    	// cumulative sum approximations.
    	rnd := rand.New(rand.NewSource(42))
    	mass := 0.0
    	var mud mud
    	for i := 0; i < 100; i++ {
    		area, l, r := rnd.Float64(), rnd.Float64(), rnd.Float64()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  4. src/crypto/ecdsa/ecdsa_legacy.go

    )
    
    // This file contains a math/big implementation of ECDSA that is only used for
    // deprecated custom curves.
    
    func generateLegacy(c elliptic.Curve, rand io.Reader) (*PrivateKey, error) {
    	k, err := randFieldElement(c, rand)
    	if err != nil {
    		return nil, err
    	}
    
    	priv := new(PrivateKey)
    	priv.PublicKey.Curve = c
    	priv.D = k
    	priv.PublicKey.X, priv.PublicKey.Y = c.ScalarBaseMult(k.Bytes())
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  5. src/crypto/rand/rand_plan9.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Plan9 cryptographically secure pseudorandom number
    // generator.
    
    package rand
    
    import (
    	"crypto/aes"
    	"internal/byteorder"
    	"io"
    	"os"
    	"sync"
    	"time"
    )
    
    const randomDevice = "/dev/random"
    
    func init() {
    	Reader = &reader{}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  6. src/crypto/rsa/pss_test.go

    	// k otherwise, where k is the length in octets of the RSA modulus n."
    	key, err := GenerateKey(rand.Reader, 513)
    	if err != nil {
    		t.Fatal(err)
    	}
    	digest := sha256.Sum256([]byte("message"))
    	signature, err := key.Sign(rand.Reader, digest[:], &PSSOptions{
    		SaltLength: PSSSaltLengthAuto,
    		Hash:       crypto.SHA256,
    	})
    	if err != nil {
    		t.Fatal(err)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 8.8K bytes
    - Viewed (0)
  7. src/slices/sort_test.go

    	}
    }
    
    func TestSortLarge_Random(t *testing.T) {
    	n := 1000000
    	if testing.Short() {
    		n /= 100
    	}
    	data := make([]int, n)
    	for i := 0; i < len(data); i++ {
    		data[i] = rand.Intn(100)
    	}
    	if IsSorted(data) {
    		t.Fatalf("terrible rand.rand")
    	}
    	Sort(data)
    	if !IsSorted(data) {
    		t.Errorf("sort didn't sort - 1M ints")
    	}
    }
    
    type intPair struct {
    	a, b int
    }
    
    type intPairs []intPair
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 09 19:20:55 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  8. src/os/writeto_linux_test.go

    	if err != nil {
    		t.Fatalf("failed to create temporary file: %v", err)
    	}
    	t.Cleanup(func() {
    		f.Close()
    	})
    
    	randSeed := time.Now().Unix()
    	t.Logf("random data seed: %d\n", randSeed)
    	prng := rand.New(rand.NewSource(randSeed))
    	data := make([]byte, size)
    	prng.Read(data)
    	if _, err := f.Write(data); err != nil {
    		t.Fatalf("failed to create and feed the file: %v", err)
    	}
    	if err := f.Sync(); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 18:12:56 UTC 2024
    - 4K bytes
    - Viewed (0)
  9. src/hash/maphash/maphash_purego.go

    package maphash
    
    import (
    	"crypto/rand"
    	"internal/byteorder"
    	"math/bits"
    )
    
    func rthash(buf []byte, seed uint64) uint64 {
    	if len(buf) == 0 {
    		return seed
    	}
    	return wyhash(buf, seed, uint64(len(buf)))
    }
    
    func rthashString(s string, state uint64) uint64 {
    	return rthash([]byte(s), state)
    }
    
    func randUint64() uint64 {
    	buf := make([]byte, 8)
    	_, _ = rand.Read(buf)
    	return byteorder.LeUint64(buf)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun May 12 05:36:29 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  10. src/crypto/ecdh/nist.go

    func (c *nistCurve[Point]) GenerateKey(rand io.Reader) (*PrivateKey, error) {
    	if boring.Enabled && rand == boring.RandReader {
    		key, bytes, err := boring.GenerateKeyECDH(c.name)
    		if err != nil {
    			return nil, err
    		}
    		return newBoringPrivateKey(c, key, bytes)
    	}
    
    	key := make([]byte, len(c.scalarOrder))
    	randutil.MaybeReadByte(rand)
    	for {
    		if _, err := io.ReadFull(rand, key); err != nil {
    			return nil, err
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 8.1K bytes
    - Viewed (0)
Back to top