@@ -21,7 +21,7 @@ const endianByteNum = (() => {
2121 return ( buf8 [ 0 ] === 0xff ) ? [ 2 , 3 , 4 , 5 , 6 , 7 ] : [ 0 , 1 , 2 , 3 , 6 , 7 ]
2222} ) ( )
2323
24- const stringWithBytes = ( bitLen , bytes , charset ) => {
24+ const stringWithBytes = ( bytes , bitLen , charset ) => {
2525 if ( bitLen <= 0 ) { return '' }
2626
2727 const bitsPerChar = charset . getBitsPerChar ( )
@@ -154,12 +154,12 @@ export default class {
154154
155155 string ( bitLen = propMap . get ( this ) . bitLen , charset = propMap . get ( this ) . charset ) {
156156 const bytesNeeded = charset . bytesNeeded ( bitLen )
157- return this . stringWithBytes ( bitLen , cryptoBytes ( bytesNeeded ) , charset )
157+ return this . stringWithBytes ( cryptoBytes ( bytesNeeded ) , bitLen , charset )
158158 }
159159
160160 stringPRNG ( bitLen = propMap . get ( this ) . bitLen , charset = propMap . get ( this ) . charset ) {
161161 const bytesNeeded = charset . bytesNeeded ( bitLen )
162- return this . stringWithBytes ( bitLen , randomBytes ( bytesNeeded ) , charset )
162+ return this . stringWithBytes ( randomBytes ( bytesNeeded ) , bitLen , charset )
163163 }
164164
165165 /**
@@ -169,8 +169,8 @@ export default class {
169169 return this . stringPRNG ( bitLen , charset )
170170 }
171171
172- stringWithBytes ( bitLen , bytes , charset = propMap . get ( this ) . charset ) {
173- return stringWithBytes ( bitLen , bytes , charset )
172+ stringWithBytes ( bytes , bitLen , charset = propMap . get ( this ) . charset ) {
173+ return stringWithBytes ( bytes , bitLen , charset )
174174 }
175175
176176 bytesNeeded ( bitLen = propMap . get ( this ) . bitLen , charset = propMap . get ( this ) . charset ) {
0 commit comments