Thrust is best explained through examples. The following source code generates random numbers serially and then transfers them to a parallel device where they are sorted.