Click here to Skip to main content
15,888,968 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Selective randomization [modified] Pin
Kevnar20-Aug-07 22:15
Kevnar20-Aug-07 22:15 
GeneralRe: Selective randomization Pin
Kevnar30-Aug-07 6:39
Kevnar30-Aug-07 6:39 
AnswerRe: Selective randomization Pin
Luc Pattyn20-Aug-07 23:08
sitebuilderLuc Pattyn20-Aug-07 23:08 
GeneralRe: Selective randomization Pin
cp987621-Aug-07 0:55
cp987621-Aug-07 0:55 
GeneralRe: Selective randomization Pin
Luc Pattyn21-Aug-07 1:33
sitebuilderLuc Pattyn21-Aug-07 1:33 
GeneralRe: Selective randomization Pin
Luc Pattyn21-Aug-07 1:39
sitebuilderLuc Pattyn21-Aug-07 1:39 
GeneralRe: Selective randomization Pin
Kevnar21-Aug-07 8:26
Kevnar21-Aug-07 8:26 
GeneralRe: Selective randomization Pin
cp987621-Aug-07 13:47
cp987621-Aug-07 13:47 
The differences between the ideas presented is the probability distribution function that results - this means the probability of each number occurring. If you have 100 numbers, the pdf is simply the probability of each occurring p1, p2 ,..p100. These must sum to 1.

My post suggested generating them with a normal distribution (bell curve), so if you were to plot the p's you would see a bell-shaped curve. The other suggestion, generating two uniform RVs in the range 1..50 and adding them would give a triangular shape if you plotted the p's.

The clever thing about Luc's post is that he can arbitrarily specify the pdf. He can do the triangular one, or have 3 peaks, two valleys and a plateau! Just by specifying the probabilities the same algorithm will generate the numbers.

I suspect that your algorithm would also give a triangular shaped plot, but with clustering around the endpoint that you were closer to (due to the way you stay in range), and dropping away around the more distant endpoint. You could easily run a large number of samples and plot the histogram to see.

Depending on the application the pdf may be very important or not. If you are generating random numbers to simulate the noise in a communications system for example, the large ones cause the errors and it is important that these are generated at the right rate relative to the others.




Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

Question2D random generator Pin
vlasto7715-Aug-07 23:02
vlasto7715-Aug-07 23:02 
AnswerRe: 2D random generator Pin
cp987616-Aug-07 0:15
cp987616-Aug-07 0:15 
AnswerRe: 2D random generator Pin
El Corazon16-Aug-07 3:54
El Corazon16-Aug-07 3:54 
AnswerRe: 2D random generator Pin
yoaz18-Aug-07 9:12
yoaz18-Aug-07 9:12 
AnswerRe: 2D random generator Pin
Russell'19-Aug-07 3:07
Russell'19-Aug-07 3:07 
QuestionColour Shades ( Quick...before Luc / CPallini answers.) Pin
Malcolm Smart15-Aug-07 2:24
Malcolm Smart15-Aug-07 2:24 
AnswerRe: Colour Shades ( Quick...before Luc / CPallini answers.) Pin
IdUnknown15-Aug-07 4:29
IdUnknown15-Aug-07 4:29 
AnswerRe: Colour Shades ( Quick...before Luc / CPallini answers.) Pin
Luc Pattyn15-Aug-07 4:42
sitebuilderLuc Pattyn15-Aug-07 4:42 
GeneralRe: Colour Shades ( Quick...before Luc / CPallini answers.) Pin
mabo4216-Aug-07 0:59
mabo4216-Aug-07 0:59 
GeneralRe: Colour Shades ( Quick...before Luc / CPallini answers.) Pin
Luc Pattyn16-Aug-07 1:02
sitebuilderLuc Pattyn16-Aug-07 1:02 
GeneralRe: Colour Shades ( Quick...before Luc / CPallini answers.) Pin
mabo4216-Aug-07 1:16
mabo4216-Aug-07 1:16 
NewsThe origins of calculus Pin
73Zeppelin14-Aug-07 12:49
73Zeppelin14-Aug-07 12:49 
GeneralRe: The origins of calculus Pin
Luc Pattyn14-Aug-07 14:15
sitebuilderLuc Pattyn14-Aug-07 14:15 
GeneralRe: The origins of calculus Pin
73Zeppelin14-Aug-07 21:21
73Zeppelin14-Aug-07 21:21 
GeneralRe: The origins of calculus Pin
A Noteworthy Programmer22-Aug-07 16:05
A Noteworthy Programmer22-Aug-07 16:05 
GeneralRe: The origins of calculus Pin
73Zeppelin23-Aug-07 0:19
73Zeppelin23-Aug-07 0:19 
GeneralRe: The origins of calculus Pin
A Noteworthy Programmer24-Aug-07 7:14
A Noteworthy Programmer24-Aug-07 7:14 

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.