github.com/blend/go-sdk@v1.20220411.3/stringutil/random.go (about)

     1  /*
     2  
     3  Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file.
     5  
     6  */
     7  
     8  package stringutil
     9  
    10  import (
    11  	"math/rand"
    12  	"time"
    13  )
    14  
    15  var (
    16  	provider = rand.New(rand.NewSource(time.Now().UnixNano()))
    17  )
    18  
    19  // Random returns a random selection of runes from the set.
    20  func Random(runeset []rune, length int) string {
    21  	return Runeset(runeset).Random(length)
    22  }