Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. package com.example.nofar.session24q3; //When i click on a button rnd and logcat will see rnd number
  2.  
  3. import android.app.Activity;
  4. import android.os.Bundle;
  5. import android.util.Log;
  6. import android.view.View;
  7.  
  8. import java.util.Random;
  9.  
  10.  
  11. public class MainActivity extends Activity {
  12. Random rnd = new Random();
  13.  
  14. @Override
  15. protected void onCreate(Bundle savedInstanceState) {
  16. super.onCreate(savedInstanceState);
  17. setContentView(R.layout.activity_main);
  18.  
  19. int y = 66; //new option ,exmple.
  20. y++;
  21. int x = 9 + rnd.nextInt(6);
  22. Log.i("calc1", x + "");
  23. }
  24.  
  25.  
  26. public void method1(View view) {//log cat rnd1
  27.  
  28. int x = 100+ rnd.nextInt(1000-100+1);//100-1000
  29. Log.i("calc1", x + "");
  30.  
  31. }
  32.  
  33. public void method2(View view) {//log cat rnd2
  34.  
  35. int x =100+ rnd.nextInt(1000-100+1) ;//100-1000
  36. Log.i("calc1", x + "");
  37. }
  38.  
  39. public void method3(View view) {//log cat rnd3
  40.  
  41. int x = 100+ rnd.nextInt(1000-100+1);//100-1000
  42. Log.i("calc1", x + "");
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement