Update math
This commit is contained in:
		
							
								
								
									
										10
									
								
								app/main.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								app/main.py
									
									
									
									
									
								
							@@ -78,17 +78,13 @@ class Session:
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def _generate_questions(n: int) -> List[Dict]:
 | 
			
		||||
        # Build unique unordered pairs (avoid mirrored duplicates like 6×8 and 8×6)
 | 
			
		||||
        all_pairs = [(a, b) for a in range(2, 6) for b in range(a, 6)]  # a <= b
 | 
			
		||||
        all_pairs = [(a, b) for a in range(2, 10) for b in range(2, 10)]  # a <= b
 | 
			
		||||
        count = min(n, len(all_pairs))
 | 
			
		||||
        print(count)
 | 
			
		||||
        picked = random.sample(all_pairs, count)
 | 
			
		||||
 | 
			
		||||
        questions: List[Dict] = []
 | 
			
		||||
        for a0, b0 in picked:
 | 
			
		||||
            # Randomize order for variety while keeping uniqueness by unordered pair
 | 
			
		||||
            if random.random() < 0.5:
 | 
			
		||||
                a, b = a0, b0
 | 
			
		||||
            else:
 | 
			
		||||
                a, b = b0, a0
 | 
			
		||||
        for a, b in picked:
 | 
			
		||||
            correct = a * b
 | 
			
		||||
            options = Session._generate_options(a, b, correct)
 | 
			
		||||
            questions.append({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user