DerEddy

Random

Dec 23rd, 2013
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.82 KB | None | 0 0
  1. #include <Date.au3>
  2. #include <GUIConstantsEx.au3>
  3.  
  4. Opt("GUIOnEventMode", 1)
  5.  
  6. $Form = GUICreate("Random Gen", 267, 110)
  7. GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
  8. GUICtrlCreateLabel("Start Value: ", 8, 8, 74, 17)
  9. GUICtrlCreateLabel("End Value: ", 8, 32, 74, 17)
  10. $iStart = GUICtrlCreateInput("2", 70, 5, 121, 21)
  11. $iEnd = GUICtrlCreateInput("9001", 70, 29, 121, 21)
  12. GUICtrlCreateLabel("Result #1: ", 8, 60, 74, 17)
  13. GUICtrlCreateLabel("Result #2: ", 8, 84, 74, 17)
  14. $iFirst = GUICtrlCreateInput("-", 70, 57, 121, 21)
  15. $iSecond = GUICtrlCreateInput("-", 70, 81, 121, 21)
  16. $all = GUICtrlCreateButton("Generate all", 196, 15)
  17. GUICtrlSetOnEvent(-1, "_GenAll")
  18. $bFirst = GUICtrlCreateButton("Generate", 196, 56, -1, 23)
  19. GUICtrlSetOnEvent(-1, "_GenFirst")
  20. $bSecond = GUICtrlCreateButton("Generate", 196, 80, -1, 23)
  21. GUICtrlSetOnEvent(-1, "_GenSecond")
  22. GUISetState(@SW_SHOW)
  23.  
  24. While 1
  25.     Sleep (100)
  26. WEnd
  27.  
  28. Func _GenAll()
  29.     $UnixTime = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
  30.     SRandom($UnixTime)
  31.     $r = Random(1, 100, 1)
  32.     $start = GUICtrlRead($iStart)
  33.     $end = GUICtrlRead($iEnd)
  34.     For $i = 0 To $r
  35.         GUICtrlSetData($iFirst, Random($start, $end, 1))
  36.         GUICtrlSetData($iSecond, Random($start, $end, 1))
  37.         Sleep (50)
  38.     Next
  39. EndFunc
  40.  
  41. Func _GenFirst()
  42.     $UnixTime = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
  43.     SRandom($UnixTime)
  44.     $r = Random(1, 100, 1)
  45.     $start = GUICtrlRead($iStart)
  46.     $end = GUICtrlRead($iEnd)
  47.     For $i = 0 To $r
  48.         GUICtrlSetData($iFirst, Random($start, $end, 1))
  49.         Sleep (50)
  50.     Next
  51. EndFunc
  52.  
  53. Func _GenSecond()
  54.     $UnixTime = _DateDiff( 's',"1970/01/01 00:00:00",_NowCalc())
  55.     SRandom($UnixTime)
  56.     $r = Random(1, 100, 1)
  57.     $start = GUICtrlRead($iStart)
  58.     $end = GUICtrlRead($iEnd)
  59.     For $i = 0 To $r
  60.         GUICtrlSetData($iSecond, Random($start, $end, 1))
  61.         Sleep (50)
  62.     Next
  63. EndFunc
  64.  
  65. Func _Exit()
  66.     Exit
  67. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment