mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	bpo-42944 Fix Random.sample when counts is not None (GH-24235) (GH-24243)
This commit is contained in:
		
							parent
							
								
									799722cb0d
								
							
						
					
					
						commit
						a90539f572
					
				
					 3 changed files with 29 additions and 28 deletions
				
			
		|  | @ -442,7 +442,7 @@ def sample(self, population, k, *, counts=None): | |||
|                 raise TypeError('Counts must be integers') | ||||
|             if total <= 0: | ||||
|                 raise ValueError('Total of counts must be greater than zero') | ||||
|             selections = sample(range(total), k=k) | ||||
|             selections = self.sample(range(total), k=k) | ||||
|             bisect = _bisect | ||||
|             return [population[bisect(cum_counts, s)] for s in selections] | ||||
|         randbelow = self._randbelow | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)