Computer Science Canada generating random real numbers |
Author: | kpayne [ Mon Feb 06, 2006 11:39 pm ] |
Post subject: | generating random real numbers |
need help ![]() with a program to generate 10 random real numbers between: a. 4 and 5 b. 0 and 10 c. 20 and 30 d. x and y, where x and y are integer values inputted by the user. |
Author: | Delos [ Tue Feb 07, 2006 12:02 am ] |
Post subject: | |
Ok, sounds doable. Now would you be so kind as to post up a little bit of your code so we can see how far you have progressed in solving this problem. Even you don't want to reveal your blindingly top secret algorithms, then pseudocode will do just fine ![]() Code would be preferred though. Don't forget to use [code] tags when you post it! |
Author: | kpayne [ Tue Feb 07, 2006 12:46 am ] |
Post subject: | |
i just started turing for the first time in my life 3 days ago. Haven't got very far with this program |
Author: | codemage [ Tue Feb 07, 2006 9:07 am ] |
Post subject: | |
Not a problem in the least. Show us what you have so far. |
Author: | do_pete [ Tue Feb 07, 2006 12:48 pm ] |
Post subject: | |
You will need for loops and the Rand.Int (upperNum, lowerNum) statement |
Author: | sylvester-27 [ Tue Feb 07, 2006 12:49 pm ] |
Post subject: | |
as long as you don't want us to do your homework for u we can help |
Author: | Albrecd [ Tue Feb 07, 2006 1:24 pm ] | ||
Post subject: | |||
From what I can gather, it seems that you want to generate a random number that includes a decimal, and your problem is that Rand.Int creates a random integer. One possible way of solving this would be to have two Rand.int Statements: one for the number and one for the decimal. Ex:
|
Author: | kpayne [ Tue Feb 07, 2006 10:05 pm ] |
Post subject: | |
I just needed some pointers and example, which u guys already posted thankx a lot ![]() |