github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/tools/trand/rand.go (about)

     1  // Package trand provides random string for dev tools and tests
     2  /*
     3   * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package trand
     6  
     7  import (
     8  	"math/rand"
     9  
    10  	"github.com/NVIDIA/aistore/cmn/cos"
    11  )
    12  
    13  func String(n int) string {
    14  	b := make([]byte, n)
    15  	for i := range n {
    16  		b[i] = cos.LetterRunes[rand.Int63()%int64(cos.LenRunes)]
    17  	}
    18  	return string(b)
    19  }