doc
This commit is contained in:
		
							parent
							
								
									12ed54f925
								
							
						
					
					
						commit
						3bee806262
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -12,10 +12,15 @@ async def get_loesungswort() -> str:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
async def set_length(seq: Sequence, length: int) -> list:
 | 
			
		||||
    # `seq` unendlich wiederholen
 | 
			
		||||
    infinite = itertools.cycle(seq)
 | 
			
		||||
    # Die ersten `length` einträge nehmen
 | 
			
		||||
    return list(itertools.islice(infinite, length))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def shuffle(seq: Sequence) -> list:
 | 
			
		||||
    # Zufallsgenerator
 | 
			
		||||
    rnd = random.Random(await get_loesungswort())
 | 
			
		||||
 | 
			
		||||
    # Elemente mischen
 | 
			
		||||
    return rnd.sample(seq, len(seq))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue