Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. import java.security.SecureRandom;
  2. import java.util.Timer;
  3. import java.util.TimerTask;
  4.  
  5. public class TestMustenberg {
  6.  
  7. private String[] massKeyWords = {"один", "апельсин", "весна", "сложность", "армия", "вечеринка"};
  8. private String result;
  9. private int attentionValue = 0;
  10. private final String AB = "0123456789Аыаофщшпоукфкпжщзуофкзщпкофщузжопкзщжфущокзщж";
  11. private SecureRandom rnd = new SecureRandom();
  12. private Timer timer = new Timer();
  13.  
  14. public String getResult(){
  15. for(int i = 0; i < massKeyWords.length; i++){
  16. result = result + randomString(6) + massKeyWords[i];
  17. }
  18. return result;
  19. }
  20.  
  21.  
  22.  
  23. public String randomString( int len ){
  24. StringBuilder sb = new StringBuilder( len );
  25. for( int i = 0; i < len; i++ )
  26. sb.append( AB.charAt( rnd.nextInt(AB.length()) ) );
  27. return sb.toString();
  28. }
  29.  
  30. public void addatteintionvalue(){
  31. attentionValue += 10;
  32. }
  33.  
  34. public void update(){
  35. timer.schedule(new TimerTask() {
  36. @Override
  37. public void run() {
  38. getAttentionValue();
  39. }
  40. },2*60*1000 );
  41. }
  42.  
  43. public int getAttentionValue(){
  44. return attentionValue;
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement