github.com/pion/webrtc/v3@v3.2.24/examples/internal/signal/rand.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package signal
     5  
     6  import "github.com/pion/randutil"
     7  
     8  // RandSeq generates a random string to serve as dummy data
     9  //
    10  // It returns a deterministic sequence of values each time a program is run.
    11  // Use rand.Seed() function in your real applications.
    12  func RandSeq(n int) string {
    13  	val, err := randutil.GenerateCryptoRandomString(n, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
    14  	if err != nil {
    15  		panic(err)
    16  	}
    17  
    18  	return val
    19  }