It involves drawing lots.
Its a quirky little thing, but its necessary to both comply with the four year, overlapping term requirement for the Senate. After every redistricting process the senate districts are new, so the constituents in each have the chance to determine who will represent them. But then this process begins so that the Senate is allowed to pull back a bit from the immediate preferences of the population.
The Texas Tribune describes the actual process as it worked its way out in the Senate today.
One by one, senators walked up to the front of the chamber and picked an envelope, each with a piece of paper inside a capsule. The papers were numbered 1-31. Senators who picked an even number will serve a two-year term. Senators who picked an odd number got a four-year term.
Simple enough.