aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2025-01-02 16:57:57 -0800
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2025-01-02 16:57:57 -0800
commit94dd1ca677c716975d43f323c97ea26f8fd4c962 (patch)
tree7eaf4f32af0a180457f935d5f2fdff941018a12f /utils
downloadsomething-94dd1ca677c716975d43f323c97ea26f8fd4c962.tar.gz
something-94dd1ca677c716975d43f323c97ea26f8fd4c962.zip
initial commit by simponic-infra
Diffstat (limited to 'utils')
-rw-r--r--utils/random_id.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/random_id.go b/utils/random_id.go
new file mode 100644
index 0000000..1b03ec8
--- /dev/null
+++ b/utils/random_id.go
@@ -0,0 +1,16 @@
+package utils
+
+import (
+ "crypto/rand"
+ "fmt"
+)
+
+func RandomId() string {
+ id := make([]byte, 16)
+ _, err := rand.Read(id)
+ if err != nil {
+ panic(err)
+ }
+
+ return fmt.Sprintf("%x", id)
+}