Click here to Skip to main content
16,005,206 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: random numbers within given range Pin
Cedric Moonen18-Apr-06 1:14
Cedric Moonen18-Apr-06 1:14 
GeneralRe: random numbers within given range Pin
9ine18-Apr-06 1:25
9ine18-Apr-06 1:25 
GeneralRe: random numbers within given range Pin
Cedric Moonen18-Apr-06 1:29
Cedric Moonen18-Apr-06 1:29 
GeneralRe: random numbers within given range Pin
9ine18-Apr-06 2:00
9ine18-Apr-06 2:00 
GeneralRe: random numbers within given range Pin
Russell'18-Apr-06 1:40
Russell'18-Apr-06 1:40 
GeneralRe: random numbers within given range Pin
9ine18-Apr-06 1:55
9ine18-Apr-06 1:55 
GeneralRe: random numbers within given range Pin
Russell'18-Apr-06 2:18
Russell'18-Apr-06 2:18 
GeneralRe: random numbers within given range Pin
9ine18-Apr-06 2:52
9ine18-Apr-06 2:52 
yes exactly uniform distribution.

we can do this by making array of indices:
0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,... N, N=MAXRAND

so the rand() value will be the index to array, but it needs the array, and time consuming, and if we change MAXVAL often it needs array recomposed etc.

but with int((double(rand())/MAXINT)*MAXVALUE) we also need to use smart rounding as int() round 3.9 and 3.1 to 3, which will inlude more computation

apparantly rand()%MAXINT will be the best choice



9ine
Questionhow can i retrieve RegNotifychangekey values Pin
keerthikaaa18-Apr-06 0:35
keerthikaaa18-Apr-06 0:35 
AnswerRe: how can i retrieve RegNotifychangekey values Pin
David Crow18-Apr-06 2:38
David Crow18-Apr-06 2:38 
AnswerRe: how can i retrieve RegNotifychangekey values Pin
Hamid_RT18-Apr-06 19:01
Hamid_RT18-Apr-06 19:01 
QuestionCheck Privileges in MFC Pin
QuickDeveloper18-Apr-06 0:34
QuickDeveloper18-Apr-06 0:34 
AnswerRe: Check Privileges in MFC Pin
David Crow18-Apr-06 2:40
David Crow18-Apr-06 2:40 
Questionwhere to store array of 2 different datatypes Pin
lorey17-Apr-06 23:59
lorey17-Apr-06 23:59 
AnswerRe: where to store array of 2 different datatypes Pin
Cedric Moonen18-Apr-06 0:02
Cedric Moonen18-Apr-06 0:02 
GeneralRe: where to store array of 2 different datatypes Pin
lorey18-Apr-06 0:06
lorey18-Apr-06 0:06 
GeneralRe: where to store array of 2 different datatypes Pin
Cedric Moonen18-Apr-06 0:11
Cedric Moonen18-Apr-06 0:11 
GeneralRe: where to store array of 2 different datatypes Pin
lorey18-Apr-06 0:18
lorey18-Apr-06 0:18 
GeneralRe: where to store array of 2 different datatypes Pin
Rob Caldecott18-Apr-06 2:57
Rob Caldecott18-Apr-06 2:57 
AnswerRe: where to store array of 2 different datatypes Pin
Nemanja Trifunovic18-Apr-06 2:31
Nemanja Trifunovic18-Apr-06 2:31 
QuestionOrder of views in MDI application Pin
Le Thanh Cong17-Apr-06 23:36
Le Thanh Cong17-Apr-06 23:36 
AnswerRe: Order of views in MDI application Pin
Parthiban18-Apr-06 0:36
Parthiban18-Apr-06 0:36 
GeneralRe: Order of views in MDI application Pin
Le Thanh Cong18-Apr-06 20:10
Le Thanh Cong18-Apr-06 20:10 
Questiontermination of the dialog Pin
mosali satish17-Apr-06 23:21
mosali satish17-Apr-06 23:21 
AnswerRe: termination of the dialog Pin
Le Thanh Cong17-Apr-06 23:29
Le Thanh Cong17-Apr-06 23:29 

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.