using EinmaleinsTrainer.Models; using System; using System.Linq; using System.Collections.Generic; namespace EinmaleinsTrainer.Services; public class QuestionGenerator { private readonly Random _random = new(); public List Generate(List rows, bool includeSquares) { var pool = new List(); foreach (var r in rows) { for (int i = 1; i <= 10; i++) pool.Add(new Question { A = r, B = i }); } if (includeSquares) { for (int i = 1; i <= 10; i++) pool.Add(new Question { A = i, B = i }); } return pool.OrderBy(_ => _random.Next()) .Take(10) .ToList(); } }