var rng = new Random(); int totalPoints = 25; int[] points = new int[5]; // To store the personality points for Outgoing, Nice, Playful, Neat, and Active string[] personalities = { "Outgoing", "Nice", "Playful", "Neat", "Active" }; // Function to randomly allocate points void AllocatePoints() { int remainingPoints = totalPoints; // First, allocate points to each personality. for (int i = 0; i < points.Length; i++) { points[i] = rng.Next(0, 11); // Assign 0-10 points to each personality remainingPoints -= points[i]; } // Adjust the remaining points for (int i = 0; i < points.Length; i++) { if (remainingPoints == 0) break; int adjustment = Math.Min(rng.Next(0, 3), remainingPoints); // Small adjustment within range points[i] += adjustment; remainingPoints -= adjustment; if (points[i] > 10) // Ensure no personality gets more than 10 points { int excess = points[i] - 10; points[i] = 10; remainingPoints += excess; // Return excess points to the pool } } // Print the final personality points for (int i = 0; i < points.Length; i++) { Console.WriteLine($"{personalities[i]}: {points[i]} points"); } Console.WriteLine($"Total remaining points in the pool: {remainingPoints}"); } // Generate the points and print the result AllocatePoints();