added class to sample cadence from .dat file, also improved code for randomly selecting file