Click here to Skip to main content
16,016,535 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Another random number generator Pin
CPallini25-Nov-07 22:39
mveCPallini25-Nov-07 22:39 
GeneralRe: Another random number generator Pin
ChandraRam25-Nov-07 22:46
ChandraRam25-Nov-07 22:46 
GeneralRe: Another random number generator Pin
CPallini25-Nov-07 23:05
mveCPallini25-Nov-07 23:05 
GeneralRe: Another random number generator Pin
ChandraRam25-Nov-07 23:10
ChandraRam25-Nov-07 23:10 
GeneralRe: Another random number generator Pin
Ian Shlasko30-Nov-07 11:48
Ian Shlasko30-Nov-07 11:48 
GeneralRe: Another random number generator Pin
ChandraRam1-Dec-07 7:32
ChandraRam1-Dec-07 7:32 
AnswerRe: Another random number generator Pin
cp987625-Nov-07 23:44
cp987625-Nov-07 23:44 
GeneralRe: Another random number generator Pin
ChandraRam25-Nov-07 23:54
ChandraRam25-Nov-07 23:54 
cp9876 wrote:
There is a brute force way to arrange these, but it is easier to describe a randomiser:

1. Start with the set of 10,000 numbers in order.
2. Generate a set of swap commands, swap the ith element with one n places away, i in [0,10000) n in [1,10000) with circular referencing. If the swap is within 10 places it always happens, if 10 - 99 places then it swaps with the nearest element in the range 10 - 99 with the same LSB, if 100 - 999 then to the nearest element with the same 2 LSB etc...
continue random swaps until the set is randomised.


To arrange by brute force:

1. generate 10000 random LSB so that each group of 10 contains {0,..,9}
2. for each group of 100 LSB's generate a random group of 100 next LSB's (i.e. 10 '0's, 10'1's etc) call these {Ai}. Assign these Ai as follows - Assign Ao to the first number. Then assign Ai with the lowest i such that the number formed by the two LSBs is not already in this group.
3. Do the same for the next LSB assigning 1000 numbers etc ..


Thank you... I shall try and post back... I am already doing the brute force method, but the first one seems quite interesting.

Meanwhile, is it possible, given a number, to say exactly where in the list it is? Speed is of essence - I will need to give out the answers within a 20 second framework, considering that I will have close to 2 million numbers that will form the base list. I cannot use any database engine...

The reason in my original post to ask for any algorithm for the generation was to see if I could utilize the reverse of that to find the position of numbers too...
GeneralRe: Another random number generator Pin
cp987626-Nov-07 0:42
cp987626-Nov-07 0:42 
GeneralRe: Another random number generator Pin
ChandraRam26-Nov-07 0:46
ChandraRam26-Nov-07 0:46 
GeneralRe: Another random number generator Pin
cp987626-Nov-07 0:51
cp987626-Nov-07 0:51 
GeneralRe: Another random number generator Pin
ChandraRam26-Nov-07 0:54
ChandraRam26-Nov-07 0:54 
GeneralRe: Another random number generator Pin
Mark Churchill19-Dec-07 15:10
Mark Churchill19-Dec-07 15:10 
GeneralRe: Another random number generator Pin
ChandraRam19-Dec-07 18:58
ChandraRam19-Dec-07 18:58 
QuestionEM algorithm Pin
yanhe011615-Nov-07 12:11
yanhe011615-Nov-07 12:11 
AnswerRe: EM algorithm Pin
Luc Pattyn15-Nov-07 12:19
sitebuilderLuc Pattyn15-Nov-07 12:19 
AnswerRe: EM algorithm Pin
El Corazon20-Nov-07 7:35
El Corazon20-Nov-07 7:35 
QuestionHow is BitBlt implemented [modified] Pin
Force Code15-Nov-07 8:15
Force Code15-Nov-07 8:15 
AnswerRe: How is BitBlt implemented Pin
Luc Pattyn15-Nov-07 8:27
sitebuilderLuc Pattyn15-Nov-07 8:27 
GeneralRe: How is BitBlt implemented Pin
Force Code15-Nov-07 8:43
Force Code15-Nov-07 8:43 
GeneralRe: How is BitBlt implemented Pin
Luc Pattyn15-Nov-07 9:22
sitebuilderLuc Pattyn15-Nov-07 9:22 
GeneralRe: How is BitBlt implemented Pin
Force Code15-Nov-07 9:54
Force Code15-Nov-07 9:54 
GeneralRe: How is BitBlt implemented Pin
Luc Pattyn15-Nov-07 10:16
sitebuilderLuc Pattyn15-Nov-07 10:16 
GeneralRe: How is BitBlt implemented [modified] Pin
Force Code15-Nov-07 11:12
Force Code15-Nov-07 11:12 
GeneralRe: How is BitBlt implemented Pin
Luc Pattyn15-Nov-07 12:03
sitebuilderLuc Pattyn15-Nov-07 12:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.