Renderer

Autoit generate random natural numbers from arrays

7 posts in this topic

Hello guys! I got myself locked up trying to solve a problem.How can i generate random natural numbers using ciphers from an array.

For example:

I have this array:

$cipher[10] = [1,2,3,4,5,6,7,8,9,0]

  How could I make the script randomly generate the 5943 number? 

Share this post


Link to post
Share on other sites



@Renderer are you talking something like this?

#include <Array.au3>

Local $cipher[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
    Local $a = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $b = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $c = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $d = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    ConsoleWrite($a & $b & $c & $d & @CRLF)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
1 hour ago, JLogan3o13 said:

@Renderer are you talking something like this?

#include <Array.au3>

Local $cipher[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
    Local $a = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $b = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $c = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    Local $d = Random(_ArrayMin($cipher), _ArrayMax($cipher), 1)
    ConsoleWrite($a & $b & $c & $d & @CRLF)

 

Yeah ! Something like this! Thanks!

Share this post


Link to post
Share on other sites

Isn't that the same as:

#include <Array.au3>

; Local $cipher[10] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]   ; is that a cipher? Really?
Local $a = Random(0, 9, 1)
Local $b = Random(0, 9, 1)
Local $c = Random(0, 9, 1)
Local $d = Random(0, 9, 1)
ConsoleWrite($a & $b & $c & $d & @CRLF)

 


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Is there any way to mix them with letters? Like 1A , 3B , 31E>

 

Share this post


Link to post
Share on other sites

Yes, there is. What have you tried on your own?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hello Just for Fun

Global Const $ASCII_A=0x41
Global Const $ASCII_Z=0x5A


For $i=1 to 100
ConsoleWrite(Random(1,99,1) & Chr(Random($ASCII_A,$ASCII_Z,1)) & @CRLF)
Next

Saludos

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