Move random out of rtc_base_approved

Bug: webrtc:9838
Change-Id: I64a5ef18c19d446139354d04aa6cb2a76d18aad0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258762
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36572}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index b7e4ba7..9420650 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -87,6 +87,7 @@
     ":macromagic",
     ":platform_thread",
     ":platform_thread_types",
+    ":random",
     ":refcount",
     ":rtc_event",
     ":safe_conversions",
@@ -133,8 +134,7 @@
     "one_time_event.h",
     "race_checker.cc",
     "race_checker.h",
-    "random.cc",
-    "random.h",
+    "random.h",  # Transitional, use :random
     "rate_statistics.cc",
     "rate_statistics.h",
     "rate_tracker.cc",
@@ -189,6 +189,18 @@
   deps = [ "system:arch" ]
 }
 
+rtc_library("random") {
+  visibility = [ "*" ]
+  sources = [
+    "random.cc",
+    "random.h",
+  ]
+  deps = [
+    ":checks",
+    ":safe_conversions",
+  ]
+}
+
 rtc_library("platform_thread_types") {
   sources = [
     "platform_thread_types.cc",
@@ -1413,6 +1425,7 @@
         ":macromagic",
         ":null_socket_server",
         ":platform_thread",
+        ":random",
         ":rate_limiter",
         ":refcount",
         ":rtc_base",