OmYcroN Posted August 19, 2010 Share Posted August 19, 2010 (edited) I need a code that can make this thing : $a = 0 $b = 0 While True $f = GenerateNumber() ; returns a random integer $a = $f ; Now the problem is that i want something like $a has the current generated number and ; $b the previous ; Ex : step 1 : $a = 10 $b = 0 ; no previous number generated ; step 2 : $a = 20 $b = 10 ; step 2 : $a = 110 $b = 20 ; and so on ... ; ; It's driving me nuts !!! Please bring some "light" here. Wend Edited August 19, 2010 by OmYcroN Link to comment Share on other sites More sharing options...
OmYcroN Posted August 19, 2010 Author Share Posted August 19, 2010 hmm ... seems it's something like this : $a = 0 $b = 0 While True $f = GenerateNumber() ; returns a random integer If $a == 0 Then $a = $f Else $b = $a $a = $f Endif Wend Sorry for the post but now it hit me ... Link to comment Share on other sites More sharing options...
UEZ Posted August 19, 2010 Share Posted August 19, 2010 My version: $a = 0 $b = 0 $i = 0 While $i < 10 $a = Random(10, 99, 1) ConsoleWrite("$a = " & $a & ", $b = " & $b & @CRLF) $b = $a $i += 1 Wend Br, UEZ:idea: Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
AlmarM Posted August 19, 2010 Share Posted August 19, 2010 (edited) I had to do the same a while ago. Here you go: HotKeySet("{ESC}", "_Exit") Global $a = 0, $b = 0 While Sleep(25) $f = Random(1, 100, 1) $b = $a $a = $f MsgBox(0, "", "Current generated number: " & $a & @CRLF & "Previous generated number: " & $b) WEnd Func _Exit() Exit EndFunc EDIT: Didn't saw UEZ's post. Both options both ^^ Edited August 19, 2010 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. 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