Subroutines that create the sample and random spin configuration.