Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > random number

Reply
Thread Tools

random number

 
 
dave
Guest
Posts: n/a
 
      08-23-2004
Hello all,
I have written one function to generate random number.
but every time I execute the function it repeats same
number many times even though I'm using Randomize.

function myrandnum()
upperbound = 32767
lowerbound = -32768
Randomize
myrandnum = Int((upperbound - lowerbound + 1) *
Rnd + lowerbound)
end function

its not as good as effective as

set objTools=server.CreateObject("MSWC.Tools")
objTools.Random()

Any help would be appreciated...
Rgds
dave

 
Reply With Quote
 
 
 
 
Bob Milutinovic
Guest
Posts: n/a
 
      08-23-2004
G'day, Dave...

A wise man once said, "the generation of random numbers is too important
to be left to chance."

Replace the generic "Randomize" statement with;

Randomize Timer

- Bob.


"dave" <(E-Mail Removed)> wrote in message
news:3c6d01c488ca$0f191590$(E-Mail Removed)...
> Hello all,
> I have written one function to generate random number.
> but every time I execute the function it repeats same
> number many times even though I'm using Randomize.
>
> function myrandnum()
> upperbound = 32767
> lowerbound = -32768
> Randomize
> myrandnum = Int((upperbound - lowerbound + 1) *
> Rnd + lowerbound)
> end function
>
> its not as good as effective as
>
> set objTools=server.CreateObject("MSWC.Tools")
> objTools.Random()
>
> Any help would be appreciated...
> Rgds
> dave
>



 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      08-23-2004
Or, use the inbult NewId() function inside sql server which does this
automatically.


"Bob Milutinovic" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> G'day, Dave...
>
> A wise man once said, "the generation of random numbers is too

important
> to be left to chance."
>
> Replace the generic "Randomize" statement with;
>
> Randomize Timer
>
> - Bob.
>
>
> "dave" <(E-Mail Removed)> wrote in message
> news:3c6d01c488ca$0f191590$(E-Mail Removed)...
> > Hello all,
> > I have written one function to generate random number.
> > but every time I execute the function it repeats same
> > number many times even though I'm using Randomize.
> >
> > function myrandnum()
> > upperbound = 32767
> > lowerbound = -32768
> > Randomize
> > myrandnum = Int((upperbound - lowerbound + 1) *
> > Rnd + lowerbound)
> > end function
> >
> > its not as good as effective as
> >
> > set objTools=server.CreateObject("MSWC.Tools")
> > objTools.Random()
> >
> > Any help would be appreciated...
> > Rgds
> > dave
> >

>
>



 
Reply With Quote
 
dave
Guest
Posts: n/a
 
      08-23-2004
Thanx Bob..It worked good

>-----Original Message-----
>G'day, Dave...
>
> A wise man once said, "the generation of random

numbers is too important
>to be left to chance."
>
> Replace the generic "Randomize" statement with;
>
> Randomize Timer
>
> - Bob.
>
>
>"dave" <(E-Mail Removed)> wrote in

message
>news:3c6d01c488ca$0f191590$(E-Mail Removed)...
>> Hello all,
>> I have written one function to generate random number.
>> but every time I execute the function it repeats same
>> number many times even though I'm using Randomize.
>>
>> function myrandnum()
>> upperbound = 32767
>> lowerbound = -32768
>> Randomize
>> myrandnum = Int((upperbound - lowerbound + 1) *
>> Rnd + lowerbound)
>> end function
>>
>> its not as good as effective as
>>
>> set objTools=server.CreateObject("MSWC.Tools")
>> objTools.Random()
>>
>> Any help would be appreciated...
>> Rgds
>> dave
>>

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
How do I get a random number between two random numbers? Alex Untitled Ruby 11 11-16-2009 09:45 AM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
OT: Number Nine, Number Nine, Number Nine FrisbeeŽ MCSE 37 09-26-2005 04:06 PM
My random number is only random for the first run??? xeys_00 C++ 12 04-11-2005 03:58 PM



Advertisments