Shoutbox

random number generater help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: random number generater help (/showthread.php?tid=29036)

random number generater help by Phrive on 07-23-2004 at 09:09 AM

i want to make a random number generator for just one number between 1 and 10 i am using c++ i used a code but i coudnt get it to work i had a time error or semething i know its real baisc any one got any help?

[edit] plz its well important its gonna be my first project and i need to have som ebasic to get me into, it for use at school and things to show ppl i can do it[/edit]


RE: random number generater help by .blade// on 07-24-2004 at 12:43 AM

quote:
Originally posted by _-PhRiVe-_
i want to make a random number generator for just one number between 1 and 10 i am using c++ i used a code but i coudnt get it to work i had a time error or semething i know its real baisc any one got any help?

[edit] plz its well important its gonna be my first project and i need to have som ebasic to get me into, it for use at school and things to show ppl i can do it[/edit]


http://www.experts-exchange.com/ is where I get all my coding help, they are very good (to ask a question or view an answer to someone else's question you do need to make a [free] account, though).
RE: random number generater help by Maniac on 07-24-2004 at 01:25 AM

Interesting how no one answered my thread when I asked for help...

Anyways, that shouldnt bee too complicated...

there's a default random function I think.... i'm guessing you could do:

int i = random(10);

unless there isn't a random function and you'd just have to get a library that uses it


RE: random number generater help by RaceProUK on 07-24-2004 at 09:23 AM

There is a random function, but you don't use it like that.

Try

code:
rand() % 10 + 1
the % performs a modulo division, yielding a number from 0-9. This is offset to get a number from 1-10.
RE: random number generater help by Maniac on 07-24-2004 at 12:59 PM

yeah true.... i'm bad at comming out with code just out of the top of my head.... i tend to need to actually do it! :p

Anyways, where can we find tutorials for basic stuff? (yes i made a whole new thread for this but NO ONE answered.... :dodgy: )


RE: random number generater help by RaceProUK on 07-24-2004 at 01:10 PM

For VB and VC++, use MSDN, or Google for some.


RE: random number generater help by Mike on 07-24-2004 at 03:55 PM

Try : http://www.pscode.com