It's important that a teacher run an organized and efficient classroom. To that end, students are assigned a number that is unique to them. It's usually a three-digit number. The first number is the class period and the rest of the number is the line number they are in the rollbook. For example, if Student A is in the Period 2 class and they are the 14th student in the rollbook, they are assigned the number #214.
Why is this done? Well, when students hand in their work, I don't have to put their papers in alphabetical order. Instead, I put the papers in order by student number. When I do this, the papers are in rollbook order and I know instantly what period the stack of papers are for because of the first number on each paper.
In addition, I often times like grading assignments anonymously just to ensure impartiality. So, in those cases, students put their number instead of their name. That way, when I'm grading their papers, I don't let how I feel about the student influence how I grade them.