This is a lottery method in simple random sampling.
Sampling according to the ratio of male to female students belongs to stratified sampling.
So draw lots first, and then use stratified sampling.
So, the answer is: draw lots first, and then sample by layers.