drupal 8: hook_pre_render code example
Example: drupal 7 hook_views_pre_render
function hook_views_pre_render(&$view) {
// Scramble the order of the rows shown on this result page.
// Note that this could be done earlier, but not later in the view execution
// process.
shuffle($view->result);
}