nitekram Posted October 4, 2008 Share Posted October 4, 2008 Well I read the help file and still am not sure - is it so that you can predict your random number? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Marlo Posted October 4, 2008 Share Posted October 4, 2008 That is indeed odd Ran this script: Local $Rand For $I = 1 To 50 SRandom(12) $rand &= Random(64, 800) & @CRLF Next MSgBox(0, "", $Rand) And i just got the same number 50 times. : / Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Pain Posted October 4, 2008 Share Posted October 4, 2008 This function initializes the random number generator by setting the state table values based on seed. Then it cycles the state information for a fixed number of times to get rid of any initial dependencies. The state table information affects the returned random numbers of the subsequent random() calls. Link to comment Share on other sites More sharing options...
Mobius Posted October 4, 2008 Share Posted October 4, 2008 That is indeed odd Ran this script: Local $Rand For $I = 1 To 50 SRandom(12) $rand &= Random(64, 800) & @CRLF Next MSgBox(0, "", $Rand) No wonder you were getting the same number Link to comment Share on other sites More sharing options...
Szhlopp Posted October 4, 2008 Share Posted October 4, 2008 SRandom is a SEEDED random number. That seed will generate the same number everytime. Inlcuding on multiple computers. As Mobius showed. It will generate the same series of numbers if it's not called everytime. Make sense? RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
nitekram Posted October 4, 2008 Author Share Posted October 4, 2008 SRandom is a SEEDED random number.That seed will generate the same number everytime. Inlcuding on multiple computers.As Mobius showed. It will generate the same series of numbers if it's not called everytime. Make sense?I wish - lolSo if you call it right before a Random() call it will generate the same number each time and if not like in Mobius example it will be a unique number? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
ProgAndy Posted October 4, 2008 Share Posted October 4, 2008 You could do something like this to initialise it new each zime: Func _MakeRandomSRand() SRandom(Round((TimerInit()*Random(1234,3335789,1)+TimerInit())/TimerInit())) EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now