I have found a thread about this question for Java but it doesn't specify what I actually need in Kotlin.
I am currently trying to random 16 int numbers and the one after is randomly increased from the last one (to prevent similarity) and the first digit of this number should have only 10% of chance to start with a '0'.
How can I specify the random chance for a certain digit?
Here's the code I have without the specification.
private val CARDNUMBERRADIX = 1000000000000000L
val rand = Random()
lastNumber = (lastNumber + 1 + rand.nextInt(100000).toLong()) % CARDNUMBERRADIX
Thank you.
Aucun commentaire:
Enregistrer un commentaire