An Urgent Question Please , Please help me 
Author Message
 An Urgent Question Please , Please help me

I Want A Program Im Writing To Generate A Random Natural Number 1,2,3,4 etc
not 1.2436543,5.42852 etc
the number has to be between 1 and 25
im using q-basic
e-mail me with the answer please



Fri, 29 Dec 2000 03:00:00 GMT  
 An Urgent Question Please , Please help me

Quote:

> I Want A Program Im Writing To Generate A Random Natural Number 1,2,3,4 etc
> not 1.2436543,5.42852 etc
> the number has to be between 1 and 25
> im using q-basic

Just use num% = int (rnd*25) +1
I think that's right...the int rounds the rnd, giving an integer.

Quote:
> e-mail me with the answer please

It's rather rude to request that.

                                                        -WFB



Fri, 29 Dec 2000 03:00:00 GMT  
 An Urgent Question Please , Please help me
Type something like this:
variablename = int(rnd * 25) + 1

Alan Jay Barrentine



Sat, 30 Dec 2000 03:00:00 GMT  
 An Urgent Question Please , Please help me

Quote:

>I Want A Program Im Writing To Generate A Random Natural Number 1,2,3,4 etc
>not 1.2436543,5.42852 etc
>the number has to be between 1 and 25
>im using q-basic
>e-mail me with the answer please


The sort routine is from the qb-45 help for SWAP
'  CLS
  RANDOMIZE TIMER
  DIM num%(500)
  DIM count(25)
  FOR j% = 1 TO 500
  num%(j%) = INT(RND * 25) + 1
'  PRINT USING "##  "; num%(I%);
  NEXT
num% = 500
Span% = num% \ 2
DO WHILE Span% > 0
    FOR i% = Span% TO num% - 1
    j% = i% - Span% + 1
        FOR j% = (i% - Span% + 1) TO 1 STEP -Span%
            IF num%(j%) <= num%(j% + Span%) THEN EXIT FOR
            '
            ' Swap array elements that are out of order.
            '
            SWAP num%(j%), num%(j% + Span%)
         NEXT j%
    NEXT i%
    Span% = Span% \ 2
LOOP
'CLS
FOR i% = 1 TO num%
'   PRINT USING "##  "; num%(i%);
k% = num%(i%)
count(k%) = count(k%) + 1

NEXT i%
PRINT
FOR j% = 1 TO 25
PRINT USING "##'s = ## "; j%; count(j%);
NEXT j%



Sat, 30 Dec 2000 03:00:00 GMT  
 An Urgent Question Please , Please help me

Quote:
>I Want A Program Im Writing To Generate A Random Natural Number 1,2,3,4 etc
>not 1.2436543,5.42852 etc
>the number has to be between 1 and 25
>im using q-basic

use INT() - or look up online help.

Quote:
>e-mail me with the answer please

sorry

--
"I see you have books under your arm, brother. It is indeed a rare pleasure
these days to come across somebody that still reads, brother."

        - Anthony Burgess



Sun, 31 Dec 2000 03:00:00 GMT  
 An Urgent Question Please , Please help me
Try:

RANDOMIZE TIMER
NUMBER=INT(RND(1)*25)+1

The variable "NUMBER" should be an integer between 1 and 25

Good luck.

Kris



Quote:
>I Want A Program Im Writing To Generate A Random Natural Number 1,2,3,4 etc
>not 1.2436543,5.42852 etc
>the number has to be between 1 and 25
>im using q-basic
>e-mail me with the answer please




Thu, 04 Jan 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

2. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

3. URGENT HELP PLEASE PLEASE PLEASE???

4. urgent please i beg please i beg please i beg

5. PLEASE HELP PLEASE HELP PLEASE HELP

6. Please help: Urgent Question

7. URGENT: VB QUESTION.......PLEASE HELP?

8. Urgent Help Help Help please

9. Formula Error...URGENT, HELP HELP HELP... PLEASE

10. Design Help PLEASE PLEASE PLEASE!

11. Please Please PLEASE HELP!!!!!

12. Please please please, help me :-)

 

 
Powered by phpBB® Forum Software