Click here to Skip to main content
15,913,709 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Selective randomization Pin
cp987621-Aug-07 13:47
cp987621-Aug-07 13:47 
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 
I don't understand your question. Are you saying that you need to generate random points located on a rectangular grid? If so, the co-ordinates are simply (nx*dx, ny*dy) where dx,dy are the grid spacings and nx and ny are integers. Simply generate random integers nx and ny.

Alternatively, if the points can be randomly located, but each extra one must be >d from each other, then I can't think of a better way than generating them randomly and rejecting each new one if it is too close to the existing ones. You could speed up the searching by storing the generated points in some sort of grid pattern.




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."
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 
GeneralRe: The origins of calculus Pin
A Noteworthy Programmer24-Aug-07 8:05
A Noteworthy Programmer24-Aug-07 8:05 
GeneralRe: The origins of calculus Pin
73Zeppelin24-Aug-07 10:31
73Zeppelin24-Aug-07 10:31 
GeneralRe: The origins of calculus Pin
A Noteworthy Programmer25-Aug-07 3:52
A Noteworthy Programmer25-Aug-07 3:52 
GeneralRe: The origins of calculus Pin
Dan Neely23-Aug-07 2:40
Dan Neely23-Aug-07 2:40 
GeneralRe: The origins of calculus Pin
Maximilien15-Aug-07 3:17
Maximilien15-Aug-07 3:17 
GeneralActually, it was Archimedes Pin
Jay Gatsby17-Aug-07 11:51
Jay Gatsby17-Aug-07 11:51 
JokeRe: The origins of calculus Pin
PIEBALDconsult26-Aug-07 5:45
mvePIEBALDconsult26-Aug-07 5:45 

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.