Hello
In my project,i need generate random string code about 1 million records
I can generate random code with RandomLibrary in php and it is very powerful library
But do we have library looklike php library in b4j?
Sub GenerateRandomString (Length As Int) As String
Dim su As StringUtils
Dim bytes(Length) As Byte
SecureRandom1.GetRandomBytes(bytes)
Return su.EncodeBase64(bytes).SubString2(0, Length)
End Sub
SecureRandom1 is a SecureRandom global variable (jEncryption or Encryption libraries).
Sub GenerateRandomString (Length As Int) As String
Dim su As StringUtils
Dim bytes(Length) As Byte
SecureRandom1.GetRandomBytes(bytes)
Return su.EncodeBase64(bytes).SubString2(0, Length)
End Sub
SecureRandom1 is a SecureRandom global variable (jEncryption or Encryption libraries).
I don't get it, what exactly do you want to do?
1- create 1Million different and Randing Strings
or
2- create 1random string a populate 1Million records with it?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.