Reduce CPU impact of QUIC stateless reset packet generation

In b/180640485 we saw that QUIC stateless reset packet generation is causing noticeable CPU impact on our servers.

The randomness in IETF QUIC stateless reset packets only exists to prevent middleboxes from comparing the entire packet to a known value. Therefore it has no cryptographic use, and does not need a secure cryptographic pseudo-random number generator. This CL introduces the notion of insecure randomness, which uses the non-secure and fast PRNG xoshiro256++. In a release build, this function was empirically shown to perform 150x faster than its secure counterpart.

Protected by FLAGS_quic_reloadable_flag_quic_stateless_reset_faster_randomness.

PiperOrigin-RevId: 358886449
Change-Id: I31ba3e19f802f3012a497ac7220430ba0d93fb9d
diff --git a/quic/core/quic_data_writer.cc b/quic/core/quic_data_writer.cc
index 1753bbe..4ed9b45 100644
--- a/quic/core/quic_data_writer.cc
+++ b/quic/core/quic_data_writer.cc
@@ -91,6 +91,17 @@
   return true;
 }
 
+bool QuicDataWriter::WriteInsecureRandomBytes(QuicRandom* random,
+                                              size_t length) {
+  char* dest = BeginWrite(length);
+  if (!dest) {
+    return false;
+  }
+
+  random->InsecureRandBytes(dest, length);
+  IncreaseLength(length);
+  return true;
+}
 
 // Converts a uint64_t into an IETF/Quic formatted Variable Length
 // Integer. IETF Variable Length Integers have 62 significant bits, so