Jump to content

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


MvGulik
 Share

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 ...
 

Link to comment
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. :mellow:

Regardless of that smiley, I'm serious.

♡♡♡

.

eMyvnE

Link to comment
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. :mellow:

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.
Link to comment
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 ...
 

Link to comment
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.
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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...