PDA

View Full Version : Real Random number



lirsch
03-26-2008, 09:08 AM
Hi All,
I want to write a small function that will get as an input number of bits and will generate a string of binary number with random bits (only 0's and 1's).
currently i've used randomize and rand and when trying to construct a 1024 bits random number after about 40 bits or so all the numbers are 1's or 0's for some reason and I think the previous ones are not that random.

Thx ...

Bob Phillips
03-26-2008, 09:15 AM
Excel uses a pseudo random number generator, you won't get really random.

ProteanBeing
03-26-2008, 09:20 AM
Are you usingRandomize Timer

lirsch
03-26-2008, 09:22 AM
Nope ... what is it and how to use it?
I'm just writing "Randomize" and line bellow use the "Rand" command ...

Can you give me the exact lines to use in order to get this function work as expected?

Thanks...

ProteanBeing
03-26-2008, 09:28 AM
Place Randomize Timer at the begining of procedure.

Bob Phillips
03-26-2008, 09:37 AM
PopTools has areal radom number generator which you culd use.

http://www.poptools.org/index.htm

lirsch
03-27-2008, 01:26 AM
GroupVal = 2048

For x = 1 To groupVal
Randomize Timer
retString = retString & LTrim$((str(Round(1 * Rnd))))
Next



It still doesn't work right ... can anyone help me ?

lirsch
03-27-2008, 01:40 AM
Sorry guys, i've watched the other parameter I have ... it's working as expected ... thanks !! :)