Re: Let's try this ONE more time :-)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hello again,


I hope i can respond to some posts before the list 'scrolls' out
of view.  That's going to be a problem sometimes.  I cant always get
back exactly the same (or next) day.

By the way, anyone know the period of the current Euphoria random
number generator?


Pete:
Maybe some people need more coffee smile

Derek:
Using 'cant' is an experiment of sorts, to find out if
the apostrophe is really needed for good communication.
No one has EVER said they couldnt understand what 'cant'
meant, over YEARS of emails and message boards.  True
this isnt the final word on 'cant' but it's good enough
for me smile
I'm fully aware about the distribution problems that can
come up, and i was the first one to mention this some
years ago here, which is why i suggested again

rnd=(rand(n)-1)*n+rand(n)-1

or the alternate form

rnd=(rand(n)-1)*n+rand(n-1)

depending on what range you need.

And what i meant by 'add' was of the form
a*n+b

not simply add two rand numbers.

Also, right after posting that proposed solution somebody else
posted the same formula he he.

BTW i didnt think yours was bad or anything, except for the rand(n) of
the first part, which of course doesnt work.


Igor:
My second language is Spanish.
As i was saying, when i said 'add' it was in the context where i
assumed a*n+b not simply a+b.  As you noted a*b doesnt work.

If you have flat distrib with rand(n), then you have flat distrib with
(rand(n)-1)*n+rand(n)-1 as well.  This is true because rand(n) is
assumed truely random.  If not, then going to 32 bits isnt going
to change it that much unless it's real bad to start with.
Yes, as someone else pointed out, in the prng sequence x(n+1)=f(x(n))
but f(x(n)) is probably remote enough from x(n) to be still considered
random, for all but the most demanding tasks, which brings us to the
second post, which mentioned a file in the archives.  In other words,
if you can get by with rand(n) then you can probably get by with the
additive (concatenated) form.
Lastly, when i said
"note you cant use rand(n) to generate 'a' above",
'a' is the first random part of the whole 32 bit number, and 'b' is the
second part.  You cant use a=rand(n) because Euphoria's
rand(n) function starts at one, not zero, so you would never get
a random 32 bit number less then hex #10000 (funny).

Juergen:
You'll have to clear up your point.  You're deduction sounds incorrect.
If you're talking about me, im lost without my spell checker smile

Christian:
I dont see how you get 2^16 possibility from two concatenated 2^16 random
sequences.  Is this what you meant?  Please explain how you arrived at
far less then 2^32 ...

All:

I'll post this again, so if anyone thinks it doesnt work, speak now...

n=#1000
r32=(rand(n)-1)*n+rand(n)-1

I could be wrong, so show me smile



Take care,
Al

And, good luck with your random number programming,
sounds like you're gonna need it smile

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu