File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
infrastructure/w3id/src/utils Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 5
5
* @returns {string }
6
6
*/
7
7
8
- export function generateRandomAlphaNum ( length = 16 ) : string {
9
- const chars =
10
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ;
11
- let result = "" ;
12
- const charsLength = chars . length ;
13
- const randomValues = new Uint32Array ( length ) ;
8
+ export function generateRandomAlphaNum ( length : number = 16 ) : string {
9
+ const chars =
10
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" ;
11
+ let result = "" ;
12
+ const charsLength = chars . length ;
13
+ const randomValues = new Uint32Array ( length ) ;
14
14
15
- crypto . getRandomValues ( randomValues ) ;
15
+ crypto . getRandomValues ( randomValues ) ;
16
16
17
- for ( let i = 0 ; i < length ; i ++ ) {
18
- result += chars . charAt ( randomValues [ i ] % charsLength ) ;
19
- }
17
+ for ( let i = 0 ; i < length ; i ++ ) {
18
+ result += chars . charAt ( randomValues [ i ] % charsLength ) ;
19
+ }
20
20
21
- return result ;
21
+ return result ;
22
22
}
You can’t perform that action at this time.
0 commit comments