[Python]Random Number Generator

Iamcoolz Feb 26, 2013

  1. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    0/47

    Joined:
    Mar 30, 2012
    Messages:
    1,227
    Likes Received:
    507
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    #Created by Iamcoolz
    #Random Number Generator

    #Importing our module random
    import random

    #User Input
    minNumber = input('What is the minimum number you want Python to generate?')
    maxNumber = input('What is the maximum number you want Python to generate?')

    #Setting the variable myNumber to the function random.
    myNumber = random.randint(minNumber,maxNumber)

    #Printing the actual number
    print (myNumber)



    Enjoyz :p
     
  2. KillerVidz

    KillerVidz Rocky BANNED
    0/47

    Joined:
    Feb 20, 2012
    Messages:
    3,312
    Likes Received:
    1,280
    Trophy Points:
    0
    Gender:
    Male
    Location:
    XPG-UK
    Console:
    Xbox One
    Cave has Made one in VB for XPG. But great work mate ;)
     
  3. Warmonger

    Warmonger Newbie BANNED
    0/47

    Joined:
    Jun 19, 2012
    Messages:
    26
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Other
    Oh geese, how long did it take you to learn just this simple bit? 3 years and counting now?
     
  4. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    205/282

    Joined:
    Mar 30, 2012
    Messages:
    1,227
    Likes Received:
    507
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    Oh geese, 5 minutes.
     
  5. Warmonger

    Warmonger Newbie BANNED
    0/47

    Joined:
    Jun 19, 2012
    Messages:
    26
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Other
    I was referring to it taking you 3+ years of trying to get to 5 lines of code. I still bet you think you're still better than me at everything huh? dis kid...
     
  6. Iamcoolz

    Iamcoolz Forum Administrator Staff Member XPG Administrator
    205/282

    Joined:
    Mar 30, 2012
    Messages:
    1,227
    Likes Received:
    507
    Trophy Points:
    205
    Gender:
    Male
    Location:
    XPG
    Console:
    Xbox One
    Just lol..
     
  7. BinaryX

    BinaryX Lifetime Gold XPG Developer Lifetime Gold
    0/47

    Joined:
    May 21, 2011
    Messages:
    971
    Likes Received:
    258
    Trophy Points:
    0
    Gender:
    Male
    Location:
    Europe
    Console:
    Xbox
    Go somwhere else with your negativity.
    Coolz check your pm.
     
  8. Warmonger

    Warmonger Newbie BANNED
    0/47

    Joined:
    Jun 19, 2012
    Messages:
    26
    Likes Received:
    1
    Trophy Points:
    0
    Console:
    Other
    That's what I am saying, check it here's some autoit code I wrote back in like 2008 that's much more complex than that. You get a cookie if you can tell me what it does!

    Code:
    #cs ----------------------------------------------------------------------------
    
     AutoIt Version: 3.3.6.1
     Author:         myName
    
     Script Function:
    	Template AutoIt script.
    
    #ce ----------------------------------------------------------------------------
    
    ; Script Start - Add your code below here
    
    #NoTrayIcon
    ;~ Function Includes
    #include <Array.au3>
    #Include <String.au3>
    #Include <File.au3>
    ;~ GUI Includes
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    
    ;~ Check For File
    If FileExists('Ebenezer.exe') = 0 Then
    	MsgBox(16, 'Error', 'Cannot Locate File')
    	Exit
    EndIf
    
    #Region
    Opt('GUIOnEventMode', 1)
    $Form1 = GUICreate('1298 SQL Login Changer', 298, 58)
    $Group1 = GUICtrlCreateGroup('Login', 8, 0, 137, 49)
    $Input1 = GUICtrlCreateInput('', 16, 16, 121, 21)
    GUICtrlSetLimit(-1, 11)
    GUICtrlCreateGroup('', -99, -99, 1, 1)
    $Group2 = GUICtrlCreateGroup('Password', 152, 0, 137, 49)
    $Input2 = GUICtrlCreateInput('', 160, 16, 121, 21)
    GUICtrlSetLimit(-1, 15)
    GUICtrlCreateGroup('', -99, -99, 1, 1)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_Write_Data')
    #EndRegion
    
    ;~ Open File For Read/Write In Binary Mode
    Global $File = FileOpen('Ebenezer.exe', 17)
    ;~ Login Pos Array
    Global $Login[11]
    $Login[0] = '25F0EC'
    $Login[1] = '25F0ED'
    $Login[2] = '25F0EE'
    $Login[3] = '25F0EF'
    $Login[4] = '25F0F0'
    $Login[5] = '25F0F1'
    $Login[6] = '25F0F2'
    $Login[7] = '25F0F3'
    $Login[8] = '25F0F4'
    $Login[9] = '25F0F5'
    $Login[10] = '25F0F6'
    ;~ Password Pos Array
    Global $Pass[15]
    $Pass[0] = '25F0DC'
    $Pass[1] = '25F0DD'
    $Pass[2] = '25F0DE'
    $Pass[3] = '25F0DF'
    $Pass[4] = '25F0E0'
    $Pass[5] = '25F0E1'
    $Pass[6] = '25F0E2'
    $Pass[7] = '25F0E3'
    $Pass[8] = '25F0E4'
    $Pass[9] = '25F0E5'
    $Pass[10] = '25F0E6'
    $Pass[11] = '25F0E7'
    $Pass[12] = '25F0E8'
    $Pass[13] = '25F0E9'
    $Pass[14] = '25F0EA'
    
    ;~ Get Current Info At Runtime
    _Get_Data()
    
    While 1 = 1
    	Sleep(1000)
    WEnd
    
    Func _Get_Data()
    	;----------------------------------------
    	;			11 Limit Login				-
    	;----------------------------------------
    	Local $Array[1]
    	;~ Read Data From File
    	For $x = 1 To 11
    		FileSetPos($File, Dec($Login[$x - 1]), $FILE_BEGIN)
    		_ArrayAdd($Array, StringTrimLeft(FileRead($File, 1), 2))
    	Next
    	;~ Print Data In GUI
    	GUICtrlSetData($Input1, _HexToString($Array[1] & $Array[2] & $Array[3] & $Array[4] & $Array[5] & $Array[6] & $Array[7] & $Array[8] & $Array[9] & $Array[10] & $Array[11]))
    	;----------------------------------------
    	;			15 Limit Password			-
    	;----------------------------------------
    	Local $Array[1]
    	;~ Read Data From File
    	For $x = 1 To 15
    		FileSetPos($File, Dec($Pass[$x - 1]), $FILE_BEGIN)
    		_ArrayAdd($Array, StringTrimLeft(FileRead($File, 1), 2))
    	Next
    	;~ Print Data In GUI
    	GUICtrlSetData($Input2, _HexToString($Array[1] & $Array[2] & $Array[3] & $Array[4] & $Array[5] & $Array[6] & $Array[7] & $Array[8] & $Array[9] & $Array[10] & $Array[11] & $Array[12] & $Array[13] & $Array[14] & $Array[15]))
    EndFunc
    
    Func _Write_Data()
    	;----------------------------------------
    	;			11 Limit Login				-
    	;----------------------------------------
    	;~ Read Data From GUI
    	$Data = StringSplit(GUICtrlRead($Input1), '')
    	;~ Write New Data
    	For $x = 1 To $Data[0]
    		FileSetPos($File, Dec($Login[$x - 1]), $FILE_BEGIN)
    		FileWrite($File, $Data[$x])
    	Next
    	;~ Fill Leftovers With 00
    	If $Data[0] < 11 Then
    		For $z = $Data[0] + 1 To 11
    			FileSetPos($File, Dec($Login[$z - 1]), $FILE_BEGIN)
    			FileWrite($File, Chr(0))
    		Next
    	EndIf
    	;----------------------------------------
    	;			15 Limit Password			-
    	;----------------------------------------
    	;~ Read Data From GUI
    	$Data = StringSplit(GUICtrlRead($Input2), '')
    	;~ Write New Data
    	For $x = 1 To $Data[0]
    		FileSetPos($File, Dec($Pass[$x - 1]), $FILE_BEGIN)
    		FileWrite($File, $Data[$x])
    	Next
    	;~ Fill Leftovers With 00
    	If $Data[0] < 15 Then
    		For $z = $Data[0] + 1 To 15
    			FileSetPos($File, Dec($Pass[$z - 1]), $FILE_BEGIN)
    			FileWrite($File, Chr(0))
    		Next
    	EndIf
    	;~ Exit
    	Exit
    EndFunc
    
     

Share This Page

Close