Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 3,876 for rand (0.22 sec)

  1. internal/lsync/lrwmutex.go

    // timing randomized back-off algorithm to try again until successful
    func (lm *LRWMutex) lockLoop(ctx context.Context, id, source string, timeout time.Duration, isWriteLock bool) (locked bool) {
    	r := rand.New(rand.NewSource(time.Now().UnixNano()))
    
    	retryCtx, cancel := context.WithTimeout(ctx, timeout)
    	defer cancel()
    
    	for {
    		select {
    		case <-retryCtx.Done():
    			// Caller context canceled or we timedout,
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 4.8K bytes
    - Viewed (0)
  2. src/archive/zip/writer_test.go

    		Method: Deflate,
    		Mode:   0755 | fs.ModeDevice | fs.ModeCharDevice,
    	},
    }
    
    func TestWriter(t *testing.T) {
    	largeData := make([]byte, 1<<17)
    	if _, err := rand.Read(largeData); err != nil {
    		t.Fatal("rand.Read failed:", err)
    	}
    	writeTests[1].Data = largeData
    	defer func() {
    		writeTests[1].Data = nil
    	}()
    
    	// write a zip file
    	buf := new(bytes.Buffer)
    	w := NewWriter(buf)
    
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Sep 15 19:04:06 GMT 2023
    - 14.1K bytes
    - Viewed (0)
  3. cmd/erasure-decode_test.go

    // You should have received a copy of the GNU Affero General Public License
    // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
    package cmd
    
    import (
    	"bytes"
    	"context"
    	crand "crypto/rand"
    	"io"
    	"math/rand"
    	"testing"
    
    	"github.com/dustin/go-humanize"
    )
    
    func (a badDisk) ReadFile(ctx context.Context, volume string, path string, offset int64, buf []byte, verifier *BitrotVerifier) (n int64, err error) {
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Tue Jan 30 20:43:25 GMT 2024
    - 21.1K bytes
    - Viewed (1)
  4. cmd/license-update.go

    import (
    	"context"
    	"fmt"
    	"math/rand"
    	"time"
    
    	"github.com/tidwall/gjson"
    )
    
    const (
    	licUpdateCycle = 24 * time.Hour * 30
    	licRenewPath   = "/api/cluster/renew-license"
    )
    
    // initlicenseUpdateJob start the periodic license update job in the background.
    func initLicenseUpdateJob(ctx context.Context, objAPI ObjectLayer) {
    	go func() {
    		r := rand.New(rand.NewSource(time.Now().UnixNano()))
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  5. internal/rest/client.go

    }
    
    // computes the exponential backoff duration according to
    // https://www.awsarchitectureblog.com/2015/03/backoff.html
    func exponentialBackoffWait(r *rand.Rand, unit, cap time.Duration) func(uint) time.Duration {
    	if unit > time.Hour {
    		// Protect against integer overflow
    		panic("unit cannot exceed one hour")
    	}
    	return func(attempt uint) time.Duration {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 14K bytes
    - Viewed (0)
  6. tests/tests_test.go

    }
    
    func RunMigrations() {
    	var err error
    	allModels := []interface{}{&User{}, &Account{}, &Pet{}, &Company{}, &Toy{}, &Language{}, &Coupon{}, &CouponProduct{}, &Order{}, &Parent{}, &Child{}, &Tools{}}
    	rand.Seed(time.Now().UnixNano())
    	rand.Shuffle(len(allModels), func(i, j int) { allModels[i], allModels[j] = allModels[j], allModels[i] })
    
    	DB.Migrator().DropTable("user_friends", "user_speaks")
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:36:08 GMT 2023
    - 3.3K bytes
    - Viewed (1)
  7. guava-tests/test/com/google/common/math/LongMathTest.java

        Random rand = new Random(1);
        for (int bits = 10; bits < 63; bits++) {
          for (int i = 0; i < 100; i++) {
            long p = BigInteger.probablePrime(bits, rand).longValue();
            assertTrue(LongMath.isPrime(p));
          }
        }
      }
    
      @GwtIncompatible // isPrime is GWT-incompatible
      public void testIsPrimeOnRandomComposites() {
        Random rand = new Random(1);
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Mar 04 20:15:57 GMT 2024
    - 32.5K bytes
    - Viewed (0)
  8. cmd/erasure.go

    	var wg sync.WaitGroup
    	disks := er.getDisks()
    	infos := make([]DiskInfo, len(disks))
    	r := rand.New(rand.NewSource(time.Now().UnixNano()))
    	for _, i := range r.Perm(len(disks)) {
    		i := i
    		wg.Add(1)
    		go func() {
    			defer wg.Done()
    
    			disk := disks[i]
    			if disk == nil {
    				infos[i].Error = errDiskNotFound.Error()
    				return
    			}
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 26 06:32:14 GMT 2024
    - 16K bytes
    - Viewed (1)
  9. doc/go1.22.html

      detailed in <a href="/issue/61716">proposal #61716</a>. The most important changes are:
    </p>
    
    <ul>
    <li>The <code>Read</code> method, deprecated in <code>math/rand</code>,
    was not carried forward for <code>math/rand/v2</code>.
    (It remains available in <code>math/rand</code>.)
    The vast majority of calls to <code>Read</code> should use
    HTML
    - Registered: Tue Feb 06 11:13:10 GMT 2024
    - Last Modified: Wed Jan 31 20:51:56 GMT 2024
    - 45.6K bytes
    - Viewed (0)
  10. cmd/benchmark-utils_test.go

    	// seeding the random number generator.
    	rand.Seed(UTCNow().UnixNano())
    	// pick a character randomly.
    	return []byte{letterBytes[rand.Intn(len(letterBytes))]}
    }
    
    // picks a random byte and repeats it to size bytes.
    func generateBytesData(size int) []byte {
    	// repeat the random character chosen size
    	return bytes.Repeat(getRandomByte(), size)
    }
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Dec 23 15:46:00 GMT 2022
    - 8.2K bytes
    - Viewed (0)
Back to top