mmmyum

randomUserInfo

Feb 17th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. Random r = new Random();
  2. int Low = 10;
  3. int High = 100;
  4. //int R = r.nextInt(High-Low) + Low;
  5. //Now on to history:
  6. //Best:
  7. tempJson = historyWeeks.getJSONObject("best");
  8. tempJsonArr = tempJson.getJSONArray("steps");
  9. int[] bestSteps = new int[7];
  10. for (int i = 0; i < 7; i++) {
  11. //bestSteps[i] = tempJsonArr.getInt(i);
  12. bestSteps[i] = r.nextInt(High-Low) + Low;
  13. }
  14. tempJsonArr = tempJson.getJSONArray("onfoot");
  15. int[] bestOnFoot = new int[tempJsonArr.length()];
  16. for (int i = 0; i < tempJsonArr.length(); i++) {
  17. bestOnFoot[i] = tempJsonArr.getInt(i);
  18. }
  19. tempJsonArr = tempJson.getJSONArray("breaks");
  20. int[] bestBreaks = new int[tempJsonArr.length()];
  21. for (int i = 0; i < tempJsonArr.length(); i++) {
  22. bestBreaks[i] = tempJsonArr.getInt(i);
  23. }
  24. //Previous:
  25. tempJson = historyWeeks.getJSONObject("previous");
  26. tempJsonArr = tempJson.getJSONArray("steps");
  27. int[] previousWeekSteps = new int[7];
  28. for (int i = 0; i < 7; i++) {
  29. //previousWeekSteps[i] = tempJsonArr.getInt(i);
  30. previousWeekSteps[i] = r.nextInt(High-Low) + Low;
  31. }
  32. tempJsonArr = tempJson.getJSONArray("onfoot");
  33. int[] previousWeekOnFoot = new int[tempJsonArr.length()];
  34. for (int i = 0; i < tempJsonArr.length(); i++) {
  35. previousWeekOnFoot[i] = tempJsonArr.getInt(i);
  36. }
  37. tempJsonArr = tempJson.getJSONArray("breaks");
  38. int[] previousWeekBreaks = new int[tempJsonArr.length()];
  39. for (int i = 0; i < tempJsonArr.length(); i++) {
  40. previousWeekBreaks[i] = tempJsonArr.getInt(i);
  41. }
  42. //Current:
  43. tempJson = historyWeeks.getJSONObject("current");
  44. tempJsonArr = tempJson.getJSONArray("steps");
  45. int[] currentWeekSteps = new int[7];
  46. for (int i = 0; i < 7; i++) {
  47. //currentWeekSteps[i] = tempJsonArr.getInt(i);
  48. currentWeekSteps[i] = r.nextInt(High-Low) + Low;
  49. }
  50. tempJsonArr = tempJson.getJSONArray("onfoot");
  51. int[] currentWeekOnFoot = new int[tempJsonArr.length()];
  52. for (int i = 0; i < tempJsonArr.length(); i++) {
  53. currentWeekOnFoot[i] = tempJsonArr.getInt(i);
  54. }
  55. tempJsonArr = tempJson.getJSONArray("breaks");
  56. int[] currentWeekBreak = new int[tempJsonArr.length()];
  57. for (int i = 0; i < tempJsonArr.length(); i++) {
  58. currentWeekBreak[i] = tempJsonArr.getInt(i);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment