Fastest method of randomly swapping array indexes / generating random alphabets in C++ std::array &lt; char, 27 &gt; new_alphabet() {
  std::array &lt; int, 26 &gt; a;

  static std::random_device rd;
  static std::mt19937 mte(rd());

  std::uniform_int_distribution &lt; int &gt; dist(0, 25);

  std::generate(a.begin(), a.end(), [ &amp; ]() {
    return dist(mte);
  });

  std::array &lt; char, 27 &gt; alpha = {
    &quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;
  };

  for (int x = 0; x &lt; 26; x++) {
    std::swap(alpha[x], alpha[a[x]]);
  }

  return alpha;
}

int main() {
  for (int i = 0; i &lt; 10000000; i++) {
    new_alphabet();
  }

  return 0;
}

The above code works fine and creates randomised alphabets, each loop would generate for example:
Y G T X R P D U L H I M V O B E F Z Q W J K A C S N
G Q I J F O P L A K M B D T R C H V Y X S U Z E N W
B O N U C Y K T H Q J F V W L M E S X A P R D Z I G
Q B D C V Z R E W O P L M S N X T H A I K U J Y G F
R J B G M E Z P V Q D Y C H I S O F X L N K T U A W
A M E S D H Q J R K Y P N X G T F B L O U W I Z V C
H E L G M F Q K J A X R S I V N W P T D O Y Z U B C
V S O B F R K A J D H Q T P N E I M X U Y Z C L W G
D E M R P Y S K G O C B A Q I H L J T U F N V X Z W
...

Generating 10,000,000 alphabets takes ~5 seconds on my 2.6 GHz i7. Compiling with g++ -std=c++11 -O3.
Is this the most efficient approach to this, and if there any optimisations, how can I improve or speed up this code?
The above uses the Mersenne Twister engine for generating 26 random values used to swap the array indexes.
Would it be possible to use an xorshift generator here?
This method is biased. Use Fisher-Yates shuffle.
TL;DR: There are \$26^{26}\$ possible outcomes of a. There are \$26!\$ possible permutations of the alphabet. Since \$26!\$ doesn't evenly divide \$26^{26}\$, permutations are not equiprobable.

Regarding speed, I don't think that generating a beforehand is beneficial. It results in 3 memory fetches down the line: alpha[x], tmp = a[x], alpha[tmp]. Generating a random number inside the loop makes only two fetches. It is likely to not be measurable with an alphabet as short as 26 characters, but when shuffling a billion-strong alphabet you'd see the difference.