+ /* The space of all files is partitioned evenly based on the number of
+ * threads. Pick a file out of our particular partition. */
+ int thread_num, thread_count;
+ if (ts->thread_num >= write_threads) {
+ /* Read */
+ thread_num = ts->thread_num - write_threads;
+ thread_count = opt_threads - write_threads;
+ } else {
+ /* Write */
+ thread_num = ts->thread_num;
+ thread_count = write_threads;
+ }
+
+ int n = get_random(opt_filecount / thread_count);
+ n += thread_num * (opt_filecount / thread_count);