var r = 12345
func rand() int {
r = r*1103515245 + 12345
return r & 0x7fffffff
}
This go function generate random numbers but I do not why it works (I did not evaluate how well it works.. just eyeballing the results). Can someone explain please? Thanks
you could see it here in action: https://go.dev/play/p/ji4-avVV1Mn
I am aware this may not be cryptographically safe.
Aucun commentaire:
Enregistrer un commentaire