dimanche 28 mai 2017

Random Did not work for me

I have tried all ways to print a Random number ,used all ways by other question on stackoverflow too but It does not work+it has an error-:

Unable to connect to the editor to retrieve text.

and other times it shows

Can't setText on null values

used Codes such as 1)

Random r = new Random();
int i1 = r.nextInt(80 - 65) + 65;
tv.setText(i1);

2)

final int random = Random.nextInt(61) + 20;
final int min = 20;
final int max = 80;
final int random = Random.nextInt((max - min) + 1) + min;

3)

tv.setText("Random Number: " + Math.random());
//Though I wanted the random in a specific range ,this too did not work




Aucun commentaire:

Enregistrer un commentaire