🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.tools.mfc
Article #155

Re: REQ : How to make random number in MFC?

#155
From: Hemendra
Date: Thu, 13 Aug 1998 00:00
30 lines
2114 bytes
On Mon, 10 Aug 1998 05:28:01 -0500, Joshua Waxman
<jwaxman@ymail.yu.edu> wrote:

>On Mon, 10 Aug 1998, Euntaek Woo wrote:
>
>> How can I make 1-digit integer random number in MFC?
>> Unlike Borland C or C++, the function 'random' doesn't work.
>> How can I do?
>> Thanx.
>> 
>The trick is to stay within the realm of standard C. That way it will work
>in every platform:
>
>srand(time(NULL));
>int r = rand() % 10; // range of 0 to 9
>
>Look up these standard functions in your online help.
>Also, see the C faq for information on how to achieve more random results
>using these standard functions.
>
>Hope this helps.
>
>Josh Waxman
>

Random generation algo is very much simple .. you may find it in any
university probability book ... you can very easly write the random
generation code.....

hemendra
Technical Details
Message-ID: <35d28b8c.5705474@msnews.microsoft.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <ph2nG1Cx9GA.219@news4.netsgo.com> <Pine.A41.3.95.980810062551.102722A-100000@acis.mc.yu.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f4d60,7a76dcfef6a35ba4
X-Google-Attributes: gidf4d60,public
X-Google-Thread: 1138df,7a76dcfef6a35ba4
X-Google-Attributes: gid1138df,public
X-Google-Thread: 10ef8f,7a76dcfef6a35ba4
X-Google-Attributes: gid10ef8f,public
X-Google-Thread: f7a51,7a76dcfef6a35ba4
X-Google-Attributes: gidf7a51,public
X-Google-Thread: fffac,7a76dcfef6a35ba4
X-Google-Attributes: gidfffac,public
X-Google-Thread: 104d65,7a76dcfef6a35ba4
X-Google-Attributes: gid104d65,public
X-Google-Thread: f959c,7a76dcfef6a35ba4
X-Google-Attributes: gidf959c,public
X-Google-Thread: f58d1,7a76dcfef6a35ba4
X-Google-Attributes: gidf58d1,public
From: hemendras@synectics.soft.net (Hemendra)
Subject: Re: REQ : How to make random number in MFC?
Date: 1998/08/13
Message-ID: <35d28b8c.5705474@msnews.microsoft.com>
X-Deja-AN: 380666754
References: <ph2nG1Cx9GA.219@news4.netsgo.com> <Pine.A41.3.95.980810062551.102722A-100000@acis.mc.yu.edu>
Reply-To: hemendras@synectics.soft.net
Newsgroups: comp.os.ms-windows.programmer.tools.mfc,han.comp.lang.c,han.comp.lang.c++,han.comp.lang.misc,han.comp.os.ms-windows.programming.misc,microsoft.public.vc.language,microsoft.public.vc.mfc,microsoft.public.vc.mfcole,microsoft.public.vc.online_help