Sign in to follow this  
Followers 0
jokke

Random without repeating anything.

3 posts in this topic

Hiya, well i have a problem like topics says.

Im trying to do a random without repeating any number again.

For $x = 0 To 254 
    $random = Random(0,255,1)
    ConsoleWrite($random&',')
Next

I know this should be possible, i just cant remember what this is called. Scramble?


UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites



Hiya, well i have a problem like topics says.

Im trying to do a random without repeating any number again.

For $x = 0 To 254 
    $random = Random(0,255,1)
    ConsoleWrite($random&',')
Next

I know this should be possible, i just cant remember what this is called. Scramble?

Maybe store the values into an var and then check if the number is in the var. If it is then do the random again and repeat the process. Im not sure on that though.

Share this post


Link to post
Share on other sites

Well i made it into a array... not so nice code but it works well =))

#include <Array.au3>

Dim $table[12],$num = -1

For $i = 0 To 11
    $num +=1
    $table[$i] = $num
Next

For $i = 0 To 11
    $random = Random(0,11,1)
    $tableold = $table[$i]
    $tablenew = $table[$random]
    
    $table[$random] = $tableold
    $table[$i] = $tablenew
Next

_ArrayDisplay($table,'')

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0