Hm, third in a row. but ...
I did some "checked on-line for quality" random assignment the above data layout.
It is not quick, because it heavily depends on cells and formulas.
But it takes into account prevoius assignments and tries to find a bood one for given tournament. See the code (to be copied into standard module Alt-F11 and then Alt_I, M);
Sub simple_mostly_formula_solution()
Dim round As Integer, allowed_max As Integer, i As Integer
Dim j As Integer, counter As Integer
'setup stage
Randomize
allowed_max = 1
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
For i = 1 To 12 'prepare space - every second column starting E
Cells(2, 2 * i + 3).Resize(50, 1).ClearContents
Next i
'main loop
For i = 1 To 12 'tournaments
Application.StatusBar = "working on tournament " & i
Do 'try several times different random assignments
counter = counter + 1
If counter > 25 * allowed_max Then 'but loosen limits after several attempts
counter = 0
allowed_max = allowed_max + 1
End If
For j = 1 To 50 'players
Cells(j + 2, 2 * i + 3).Value = Rnd()
Next j
Application.Calculate 'fire the formulas in the sheet
Loop Until Application.WorksheetFunction.Max(Range("AQ3:CN52")) <= allowed_max
Next i
'finishing
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.StatusBar = ""
End Sub
I did several test runs (observe status bar for the progress information) and only once there were any 4-times with the same player situations. The rest are mostly 0,1,2 and some ca. 30 with 3-times.
The quality shall be even beter if in
counter > 25 * allowed_max
some higher critical counter value is used, but what is reasonable limit here depends on the computing power of machine used, and user patience :-P. 25 shall be few seconds, may be some half minute on slower processor.
Bookmarks