Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 627 for nrand (0.04 sec)

  1. test/ken/chan.go

    // license that can be found in the LICENSE file.
    
    // 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
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 24 05:24:24 UTC 2012
    - 4.7K bytes
    - Viewed (0)
  2. src/runtime/rand.go

    	unlock(&globalRand.lock)
    }
    
    // rand32 is uint32(rand()), called from compiler-generated code.
    //
    //go:nosplit
    func rand32() uint32 {
    	return uint32(rand())
    }
    
    // rand returns a random uint64 from the per-m chacha8 state.
    // Do not change signature: used via linkname from other packages.
    //
    //go:nosplit
    //go:linkname rand
    func rand() uint64 {
    	// Note: We avoid acquirem here so that in the fast path
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 31 14:32:47 UTC 2024
    - 8K bytes
    - Viewed (0)
  3. src/math/rand/v2/rand.go

    }
    
    // New returns a new Rand that uses random values from src
    // to generate other random values.
    func New(src Source) *Rand {
    	return &Rand{src: src}
    }
    
    // Int64 returns a non-negative pseudo-random 63-bit integer as an int64.
    func (r *Rand) Int64() int64 { return int64(r.src.Uint64() &^ (1 << 63)) }
    
    // Uint32 returns a pseudo-random 32-bit value as a uint32.
    func (r *Rand) Uint32() uint32 { return uint32(r.src.Uint64() >> 32) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 02:25:49 UTC 2024
    - 12.8K bytes
    - Viewed (0)
  4. src/math/rand/rand.go

    	readPos int8
    }
    
    // New returns a new [Rand] that uses random values from src
    // to generate other random values.
    func New(src Source) *Rand {
    	s64, _ := src.(Source64)
    	return &Rand{src: src, s64: s64}
    }
    
    // Seed uses the provided seed value to initialize the generator to a deterministic state.
    // Seed should not be called concurrently with any other [Rand] method.
    func (r *Rand) Seed(seed int64) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 22:09:08 UTC 2024
    - 16.9K bytes
    - Viewed (0)
  5. src/math/rand/gen_cooked.go

    			rngVec[i] = u
    		}
    	}
    }
    
    func vrand() int64 {
    	rngTap--
    	if rngTap < 0 {
    		rngTap += length
    	}
    	rngFeed--
    	if rngFeed < 0 {
    		rngFeed += length
    	}
    	x := (rngVec[rngFeed] + rngVec[rngTap])
    	rngVec[rngFeed] = x
    	return x
    }
    
    func main() {
    	srand(1)
    	for i := uint64(0); i < 7.8e12; i++ {
    		vrand()
    	}
    	fmt.Printf("rngVec after 7.8e12 calls to vrand:\n%#v\n", rngVec)
    	for i := range rngVec {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 18:17:57 UTC 2021
    - 1.5K bytes
    - Viewed (0)
  6. src/go/doc/comment_test.go

    		input           = "[T] and [U] are types, and [T.M] is a method, but [V] is a broken link. [rand.Int] and [crand.Reader] are things. [G.M1] and [G.M2] are generic methods.\n"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 10 06:33:18 UTC 2022
    - 3K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apimachinery/pkg/util/rand/rand.go

    See the License for the specific language governing permissions and
    limitations under the License.
    */
    
    // Package rand provides utilities related to randomization.
    package rand
    
    import (
    	"math/rand"
    	"sync"
    	"time"
    )
    
    var rng = struct {
    	sync.Mutex
    	rand *rand.Rand
    }{
    	rand: rand.New(rand.NewSource(time.Now().UnixNano())),
    }
    
    // Int returns a non-negative pseudo-random int.
    func Int() int {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 11 11:02:01 UTC 2018
    - 3.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/cmd/bisect/rand.go

    // license that can be found in the LICENSE file.
    
    // Starting in Go 1.20, the global rand is auto-seeded,
    // with a better value than the current Unix nanoseconds.
    // Only seed if we're using older versions of Go.
    
    //go:build !go1.20
    
    package main
    
    import (
    	"math/rand"
    	"time"
    )
    
    func init() {
    	rand.Seed(time.Now().UnixNano())
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:10 UTC 2023
    - 442 bytes
    - Viewed (0)
  9. src/crypto/rand/rand.go

    // Copyright 2010 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    // Package rand implements a cryptographically secure
    // random number generator.
    package rand
    
    import "io"
    
    // Reader is a global, shared instance of a cryptographically
    // secure random number generator.
    //
    //   - On Linux, FreeBSD, Dragonfly, and Solaris, Reader uses getrandom(2)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 19 20:02:21 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  10. src/go/doc/testdata/pkgdoc/doc.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package pkgdoc
    
    import (
    	crand "crypto/rand"
    	"math/rand"
    )
    
    type T int
    
    type U int
    
    func (T) M() {}
    
    var _ = rand.Int
    var _ = crand.Reader
    
    type G[T any] struct{ x T }
    
    func (g G[T]) M1() {}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 10 06:33:18 UTC 2022
    - 376 bytes
    - Viewed (0)
Back to top