|
-
May 26th, 2010, 10:41 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Unable to generate a random number
I have been looking around for code to randomly generate a number. What I seem to find over and over is this...
Rand = ((High - Low + 1) * Rnd) + Low
or
Rand = Int(Rnd * Upperbound) + Lowerbound
or
Rand = Int(Rnd * high) + low
or
Rand = CInt(Int((high * Rnd()) + low))
No matter what version I use, when I go to generate the number for the first time, it's always the same number. If I repeatedly do it, it does give me different numbers, but I don't want the first number to always be the same. Does anyone have a good random number generator?
-
May 26th, 2010, 10:42 AM
#2
Re: Unable to generate a random number
Try Randomize.
You can also set your own seed, ensuring a 'different'(specific to the seed) yet repeatable series of digits.
Code:
Rnd -1
Randomize seed
Software I use and highly recommend: Opera, Miranda IM, Peerblock, Winamp, Unlocker Assistant, JoyToKey, Virtual CloneDrive, Secunia PSI, ExplorerXP, GOM Player, Real Alternative, Quicktime Alternative,Sumatra PDF, and non-freeware: Photoshop and VB6( ).
My codebank: AllRGB, Rounded Rectangle(math), Binary Server, Buddy Paint, LoadPictureGDI+, System GUID/Volume Serial, HexToAsc, List all processes and their paths, quasiString matching
Strings(search, extraction, retrieval etc): Retrieve BBCode Link from HTML, RemoveBetween ()'s, strFindBetween(str1,str2), Insert text in HTML, HTML - GetSpanByID
-
May 26th, 2010, 10:45 AM
#3
Thread Starter
Hyperactive Member
Re: Unable to generate a random number
Oh yeah, I left out Randomize before generating the number. Thanks FireXtol!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|