1. Let's try this ONE more time :-)
- Posted by Al Getz <Xaxo at aol.com> Jul 05, 2004
- 547 views
For people that cant read English, i post this one more time: constant n=#10000 function Rand32() --no reason why you cant make this more inline... atom a,b,c a=rand(n)-1 b=rand(n)-1 c=a*n+b return c end function Notes: 1. For two added rnd numbers the distribution should be the same. It's multiplication that changes the distribution. 2. Two rand sequences from the same generator that show no correlation, when added, form a new rand sequence that will show no correlation to another rand sequence generated in exactly the same way. 3. Multiplication, such as rand1*rand2 changes the distribution greatly. 4. Note that to generate 'a' above you cant use rand(n). Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
2. Re: Let's try this ONE more time :-)
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 05, 2004
- 528 views
On Mon, 05 Jul 2004 11:51:21 -0700, Al Getz <guest at RapidEuphoria.com> wrote: >For people that cant read English, i post this one more time: And people say I need to try decaffeinated. )
3. Re: Let's try this ONE more time :-)
- Posted by Al Getz <Xaxo at aol.com> Jul 06, 2004
- 550 views
Pete Lomax wrote: > > On Mon, 05 Jul 2004 11:51:21 -0700, Al Getz <guest at RapidEuphoria.com> > wrote: > > >For people that cant read English, i post this one more time: > And people say I need to try decaffeinated. ) > > There were at least TWO (count em, 2> ) posts suggesting a method of generating 32 bit random numbers which were perfectly fine, and yet people were still bickering over what to do about generating a 32 bit rand number ?? Makes me wonder about the intellegence level in this group, any IQ's over 20 here, or did i miss something somewhere... Take care, Al And, good luck with your Euphoria programming, if you can find the keyboard, that is! My bumper sticker: "I brake for LED's"
4. Re: Let's try this ONE more time :-)
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Jul 06, 2004
- 511 views
On Mon, 05 Jul 2004 17:24:00 -0700, Al Getz <guest at RapidEuphoria.com> wrote: >Makes me wonder about the intellegence level in this group, >any IQ's over 20 here, or did i miss something somewhere... Charm on overdrive, I see.
5. Re: Let's try this ONE more time :-)
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 06, 2004
- 501 views
Al Getz wrote: > > Pete Lomax wrote: > > > > On Mon, 05 Jul 2004 11:51:21 -0700, Al Getz <guest at RapidEuphoria.com> > > wrote: > > > > >For people that cant read English, i post this one more time: > > And people say I need to try decaffeinated. ) > > > > > There were at least TWO (count em, 2> ) posts suggesting > a method of generating 32 bit random numbers which were > perfectly fine, and yet people were still bickering over > what to do about generating a 32 bit rand number ?? Bickering? Suggesting alternates is normal in programming. Why do you think this is evidence of bickering? There are a huge number of ways to generate a 32-bit random number. So what's the problem if people suggest some alternatives? > Makes me wonder about the intellegence level in this group, > any IQ's over 20 here, or did i miss something somewhere... Apparently so. For example, "cant" is really spelled "can't"; the 1-st person singular pronoun is supposed to be spelled "I" and not "i"; and adding two random numbers does not produce a third random number. Let's say we are trying for random numbers from 1 to 100. If we are using two independant random number generators 'randA' and 'randB', and use something like floor(randA(100) + randB(100)) / 2) to do this. This seems reasonable, but consider this... What is the probability of getting 25? Which is two random numbers adding up to 50 then dividing by 2? Quite high, actually. We have 1+49, 2+48, 3+47, ... 49+1; which 49 out of a possible 10000 different sums. Now how about the probability of 1? (two randoms adding up to 2). 1+1; which is 1 out of 10000. Thus we have very poor distribution of numbers if we just use the additive method. And the story is much the same for multipliction, though the distribution curve is a different shape. For concatenation though, its more like this... Formula --> (randA(10)-1) * 10 + (randB(10)-1) + 1 The probability for 25 ('2' followed by '5') is (1/10 * 1/10) ==> 1/100. The probability for 1 ('0' followed by '1') is (1/10 * 1/10) ==> 1/100. Etc for all numbers in the range. A uniform probability distribution. > Take care, Good advice, doctor. -- Derek Parnell Melbourne, Australia
6. Re: Let's try this ONE more time :-)
- Posted by "Igor Kachan" <kinz at peterlink.ru> Jul 06, 2004
- 503 views
Hi Al, You wrote: ---------- > From: Al Getz <guest at RapidEuphoria.com> > To: EUforum at topica.com > Subject: Let's try this ONE more time > Sent: 5 jul 2004 y. 22:51 > > posted by: Al Getz <Xaxo at aol.com> > > For people that cant read English, If people cant read English, then any new your attempt to bring the truth in the last instance in English looks like crazy next one. Da, ne tak li? --> Yes, isn't it? Try another language please, great Mumbo Jumbo can be good ... I think ... I do not know ... Russian is good, Juergen loves German, I think ... What is your favourite second language? > i post this one more time: > > constant n=#10000 > > function Rand32() > --no reason why you cant make this more inline... > atom a,b,c > > a=rand(n)-1 > b=rand(n)-1 > c=a*n+b > return c > end function > Notes: > 1. For two added rnd numbers the distribution > should be the same. Sum of two random numbers with same flat distribution gives the number with triangle distribution (Simpson's distribution). What do you mean under "two added rnd numbers" ? > It's multiplication that changes the distribution. Yes, multiplication changes the distribution too. > 2. Two rand sequences from the same generator that > show no correlation, when added, form a new rand > sequence that will show no correlation to another > rand sequence generated in exactly the same way. Correlation and distribution are the different things. We need the flat distribution in [0,#FFFFFFFF] range, as far as I can see in the first Juergen's post. > 3. Multiplication, such as rand1*rand2 > changes the distribution greatly. Yes, changes. > 4. Note that to generate 'a' above you cant use rand(n). Shoot me, I can not understand this your note ... > Take care, > Al > > And, good luck with your Euphoria programming! Good Luck! Regards, Igor Kachan kinz at peterlink.ru
7. Re: Let's try this ONE more time :-)
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 06, 2004
- 532 views
Derek Parnell wrote: > Al Getz wrote: >> >> Pete Lomax wrote: >>> >>> On Mon, 05 Jul 2004 11:51:21 -0700, Al Getz <guest at RapidEuphoria.com> >>> wrote: >>> >>> For people that cant read English, i post this one more time: >>> And people say I need to try decaffeinated. ) >>> >>> >> There were at least TWO (count em, 2> ) posts suggesting >> a method of generating 32 bit random numbers which were >> perfectly fine, and yet people were still bickering over >> what to do about generating a 32 bit rand number ?? > > Bickering? Suggesting alternates is normal in programming. Why do you > think this is evidence of bickering? > > There are a huge number of ways to generate a 32-bit random number. So > what's the problem if people suggest some alternatives? [big snip] Derek, thank you for saying this clearly! Yes, suggesting alternates is normal when you think in a problem oriented manner. This way of discussion means a spirit of freedom of thinking, of willingness to share knowledge, a spirit of evolution and so on. I always learn a lot when reading or participating in a good discussion. Who wants to prevent me (or someone else) from learning? However, if someone thinks more in a vanity oriented manner (e.g. thinking that he is the most intelligent person on this planet), it's likely that he mistakes "discussion" for "bickering". Regards, Juergen
8. Re: Let's try this ONE more time :-)
- Posted by Al Getz <Xaxo at aol.com> Jul 07, 2004
- 498 views
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 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 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 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 Take care, Al And, good luck with your random number programming, sounds like you're gonna need it My bumper sticker: "I brake for LED's"
9. Re: Let's try this ONE more time :-)
- Posted by Robert Craig <rds at RapidEuphoria.com> Jul 07, 2004
- 545 views
Al Getz wrote: > By the way, anyone know the period of the current Euphoria random > number generator? I believe it's something like power(2, 61). If you had been computing one rand() per second since the "Big Bang", you might be getting close to repeating by now. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
10. Re: Let's try this ONE more time :-)
- Posted by Al Getz <Xaxo at aol.com> Jul 08, 2004
- 528 views
Robert Craig wrote: > > Al Getz wrote: > > By the way, anyone know the period of the current Euphoria random > > number generator? > > I believe it's something like power(2, 61). > > If you had been computing one rand() per second > since the "Big Bang", you might be getting close > to repeating by now. > > Regards, > Rob Craig > Rapid Deployment Software > <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a> > Wow, that sounds a little too good Any way you know of to test that... Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"
11. Re: Let's try this ONE more time :-)
- Posted by Robert Craig <rds at RapidEuphoria.com> Jul 08, 2004
- 536 views
Al Getz wrote: > > Robert Craig wrote: > > > > Al Getz wrote: > > > By the way, anyone know the period of the current Euphoria random > > > number generator? > > > > I believe it's something like power(2, 61). > > > > If you had been computing one rand() per second > > since the "Big Bang", you might be getting close > > to repeating by now. > > Wow, that sounds a little too good > Any way you know of to test that... No. Even at a billion/sec it should take years to repeat. I got that statistic from some notes I wrote several years ago when I implemented the algorithm. The algorithm was on a university web site somewhere. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
12. Re: Let's try this ONE more time :-)
- Posted by Al Getz <Xaxo at aol.com> Jul 08, 2004
- 534 views
Rob, Ok thanks. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's", but not for Euphoria programmers" hee hee, kidding