# Keeping track of large(2^32) element collection.

## Recommended Posts

whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

If you want to generate numbers from 0 to 2^32 and want every number to be generated only once (that's the expression) the fastest way, by far, is to simply start with 0 and add 1 to every new number, even if that seems too obvious.

Regardless of that smiley, I'm serious.

.

eMyvnE

##### Share on other sites

If you want to generate numbers from 0 to 2^32 and want every number to be generated only once (that's the expression) the fastest way, by far, is to simply start with 0 and add 1 to every new number, even if that seems too obvious.

Regardless of that smiley, I'm serious.

Exactly, but I assume MvGulik didn't say what he meant.

If he wants a random number in a range which is never repeated then here is a way

```\$n = 4;how big the largest number should be
Dim \$aN[2 ^ \$n + 1]
For \$a = 1 To 2 ^ \$n
\$aN[\$a] = \$a
Next

For \$a = 2 ^ \$n To 2 Step -1
\$element = Random(1, \$a, 1)
\$nextnumber = \$aN[\$element]
ConsoleWrite(\$nextnumber & @CRLF)
\$aN[\$element] = \$aN[\$a]
Next
\$nextnumber = \$aN[1]
ConsoleWrite(\$nextnumber & @CRLF)```

That way there is never any need to check that you have a duplicate.

But for the range you say you want I would think of getting another job.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

##### Share on other sites
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...

##### Share on other sites

This is rather a pseudo-random permutation of the numbers 1..232

Not the same guy!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
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)

## Create an account

Register a new account