Question on Percents

1. Member
Join Date
Dec 1969
Posts
62

## Question on Percents

Hi, All<BR> I have or I should say am trying to write a code that will come up true or faults so many times per 100. I want true to come up 63% of the time out of 100 and faults to come up 37% of the time. Any ideal I can do this with asp? Any help or even a starting point would be a great help.<BR>Thanks

2. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: Question on Percents

did you really just post to the advanced forum and still mis-spell &#039;false&#039;? I don&#039;t believe it.

3. Member
Join Date
Dec 1969
Posts
62

## RE: Question on Percents

I am sorry that I spelled a word wrong. Are you happy now and can you please get pass the mis-spelled word. I see that you didn&#039;t try to answer the question. Are you so wraped up in spelling that you don&#039;t know anything else?

4. Senior Member
Join Date
Dec 1969
Posts
19,082

## RE: Question on Percents

just an observation, buster, no need to get narky.

5. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Question on Percents

Easiest way.<BR><BR>Create a random number between 0 and 99.<BR>&#060;%<BR>Randomize<BR>Dim myNumber: myNumber = Int(Rnd() * 100)<BR>%&#062;<BR>Then it&#039;s straight-forward. Stick it in a function.<BR>&#060;%<BR>Function GetRandom()<BR> Randomize<BR> GetRandom = (Int(Rnd() * 100) &#060; 63)<BR>End Function<BR>%&#062;<BR><BR>Of course if you&#039;re calling this multiple times it may well be worth sticking the Randomise outside the loop. But hey.<BR><BR>Craig.

6. Member
Join Date
Dec 1969
Posts
62

## RE: Question on Percents

Thanks, Craig<BR> This is a big help :-) you gave me a good starting point. I still will have to fine away to turn the number into a true or false, but if you did that also I would not have anything to do. Again thanks for the help, I don&#039;t think I will every be able to return the favor to you but I hope that I will be able to pass it on by helping someone else out there.<BR>Have a Great Day!<BR>Tim Akers

7. Member
Join Date
Dec 1969
Posts
62

## RE: Question on Percents

Craig thank you, thank you I just ran the code and it does give me a true / false :-) I see that you have done all the work for me. It works great!

8. Senior Member
Join Date
Dec 1969
Posts
16,931

## No problem.

Always ready to help people. I suggest that you post things like this in the "ASP Q&A" forum first, though. They don&#039;t really qualify as "Advanced".<BR><BR>That said, stick around - it&#039;s always good to have a lively forum. You&#039;ll be surprised the amount you&#039;ll learn from reading threads here. Soon enough you&#039;ll find yourself helping others and it&#039;ll have gone full-cycle!<BR><BR>Craig.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•