From 18a945aab9b3129b82076f633fab1d13ba28148e Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 12 Jan 2025 23:09:34 -0800 Subject: initial commit by simponic-infra --- utils/random_id.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 utils/random_id.go (limited to 'utils/random_id.go') 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) +} -- cgit v1.2.3-70-g09d2