From 5f4611d65e40eae3ca6191a15f68d69ea5a1c4cb Mon Sep 17 00:00:00 2001
From: Kirill Rogovoy <kirill@rogovoy.me>
Date: Tue, 20 Jul 2021 21:24:52 +0300
Subject: WIP

---
 app_expo/data/randomdata.tsx | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 app_expo/data/randomdata.tsx

(limited to 'app_expo/data/randomdata.tsx')

diff --git a/app_expo/data/randomdata.tsx b/app_expo/data/randomdata.tsx
new file mode 100644
index 0000000..844f36f
--- /dev/null
+++ b/app_expo/data/randomdata.tsx
@@ -0,0 +1,11 @@
+export default function genRandomTree(N = 300, reverse = false) {
+  return {
+    nodes: [...Array(N).keys()].map((i) => ({ id: i })),
+    links: [...Array(N).keys()]
+      .filter((id) => id)
+      .map((id) => ({
+        [reverse ? 'target' : 'source']: id,
+        [reverse ? 'source' : 'target']: Math.round(Math.random() * (id - 1)),
+      })),
+  }
+}
-- 
cgit v1.2.3

