Dynamic weight for Blocks
Drupal 8 is providing a hook to alter the region template_preprocess_region, it would prepares values to the theme_region.Adding the following codes in THEMENAME.theme file would solve the problems,

function themename_preprocess_region(&amp;$variables) {
  if ($variables['region'] == 'sidebar_second') {
    $variables['elements'] = shuffle_assoc($variables['elements']);
    $content = '';
    foreach ($variables['elements'] as $key =&gt; $value) {
      if (is_array($variables['elements'][$key])) {
        $content .= \Drupal::service ('renderer')-&gt;render($value);
      }
    }
    $variables['content'] = array(
      '#markup' =&gt; $content,
    );
  }
}

function shuffle_assoc($list) {
  if (!is_array($list)) {
    return $list;
  }

  $keys = array_keys($list);
  shuffle($keys);
  $random = array();
  foreach ($keys as $key) {
    $random[$key] = $list[$key];
  }
  return $random;
}


For more details, check here