Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

new to programming

HridayaHridaya Member Posts: 2
Hello,
Thankyou for making me a part of you.
I am new to C++, recently i am working on C language. I need to know about random number generation, and the logic behind it.Randomly select coordinates (x,y) between 0 to 1 on both axis.i don't know from where to start.
thanks.
Hridaya.

Comments

  • LundinLundin Member Posts: 3,711
    www.msdn.com has pretty much all the documentation you need. The functions needed for random stuff is srand() and rand() located in stdlib.h. You need to know how functions work and how the modulo (%) operator works before you can do this project, so I suggest starting by learning those things unless you know them already.
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : www.msdn.com has pretty much all the documentation you need. The
    : functions needed for random stuff is srand() and rand() located in
    : stdlib.h. You need to know how functions work and how the modulo (%)
    : operator works before you can do this project, so I suggest starting
    : by learning those things unless you know them already.

    [color=Blue]Values between 0 and 1 will not be produced using modulo operations. You need something like this:
    [code]
    double dblRandomValue = (double) rand () / (double) MAX_INT;
    [/code]
    [/color]
Sign In or Register to comment.