The principle behind organizing citizens’ assemblies is that their members are selected at random. Random selection is conducted in such a way that the composition of an assembly reflects selected demographic, social, or economic criteria in the same proportions as in the society as a whole. Inclusion of demographic criteria in the composition of the group – stratification - creates a challenge with regards to how to draw assembly members in accordance with democratic principles. We propose that the priority for random selection should be given to accuracy in terms of how precisely the demographic criteria are reflected in the composition of the group. The method we have developed to achieve this is based on the algorithm of simulated annealing. We have found that simulated annealing makes it possible to achieve good results in terms of the Closeness Index, and also creates a large number of unique panels, offering in this way a large number of possibilities for the volunteers to be selected to an assembly. A well-designed method for random selection improves the legitimacy of the citizens’ assembly process, and thus of deliberative democracy.