Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TakeRandom (0.18 sec)

  1. src/database/sql/sql_test.go

    	for range b.N {
    		for range 16 {
    			s.Add(nil)
    		}
    		for range 8 {
    			if _, ok := s.TakeRandom(); !ok {
    				b.Fatal("want ok")
    			}
    		}
    		for range 8 {
    			s.Add(nil)
    		}
    		for range 16 {
    			if _, ok := s.TakeRandom(); !ok {
    				b.Fatal("want ok")
    			}
    		}
    		if _, ok := s.TakeRandom(); ok {
    			b.Fatal("unexpected ok")
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 111.6K bytes
    - Viewed (0)
  2. src/database/sql/sql.go

    	s.s[len(s.s)-1] = connRequestAndIndex{}
    	s.s = s.s[:len(s.s)-1]
    }
    
    // TakeRandom returns and removes a random element from s
    // and reports whether there was one to take. (It returns ok=false
    // if the set is empty.)
    func (s *connRequestSet) TakeRandom() (v chan connRequest, ok bool) {
    	if len(s.s) == 0 {
    		return nil, false
    	}
    	pick := rand.IntN(len(s.s))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:53 UTC 2024
    - 103.6K bytes
    - Viewed (0)
Back to top