random ints on symmetric interval
  Home FAQ Contact Sign in
 
Advanced search
MATCHING GROUPS



more...
POPULAR GROUPS

more...

found 12 articles for 0.001 sec
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: e p chandler
Date: Sep 18, 2008 23:28

...> right about the ultimate calculation here: ! calculates percent of UB for b-a on a symmetric interval [snip]  inbounds =                749970  outbounds =          ...25.0030      %% I wonder how big the interval can get before the numbers start to get "grainy" with b = -i_max + int( harvest * i_tot )? How would a person stich together 2 ...
Show full article (0.72Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: Ron Ford
Date: Sep 18, 2008 16:02

... is better than   b = -i_max + int( harvest * i_tot ) That's a ... for b-a on a symmetric interval implicit none integer, parameter ...real:: harvest, ratio, percent ! seed random num generator CALL init_random_seed ! prime ... call random_number(harvest) b = -i_max + int( harvest * i_tot ) call random_number(harvest)...I wonder how big the interval can get before the numbers ...
Show full article (2.99Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: glen herrmannsfeldt
Date: Sep 18, 2008 18:02

... on the right. For twos complement it would be -8. In the large number limit, it won't make a big difference. It was so simple to write a fortran program that the busts the C int datatype. One thing I dislike so much about c is struggling with the format specifiers with printf, while with fortran it's just print * for something quick and sleazy. Fortran didn't used to make ...
Show full article (1.09Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: Ron Ford
Date: Sep 18, 2008 16:33

...suggested by the custom quote there with the negative in front of the first arg and then the same positive values on the right. It was so simple to write a fortran program that the busts the C int datatype. One thing I dislike so much about c is struggling with the format specifiers with printf, while with fortran it's just print * for something quick and sleazy. -- A cynic is a man who...
Show full article (1.32Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: e p chandler
Date: Sep 17, 2008 06:38

On Sep 17, 2:52 am, Ron Ford <r...@example.invalid> wrote: Why do I believe that b = min(max(1,ceiling(harvest*sides)),sides) is better than   b = -i_max + int( harvest * i_tot ) That's a matter of "taste". :-). For each of us our choice illustrates our own thought process. - e
Show full article (0.30Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: Ron Ford
Date: Sep 17, 2008 00:25

... that the previously suggested: b = -i_max + int( harvest * i_tot ) ceiling(harvest*sides) mostly...> If you have two (approximately) symmetric distributions uniform over, for example, ... Richard wrote: %%- %%- %%- > Whats wrong with merely %%- >> %%- >> int mycmp(const void *a, const void ...for example, a simple four-bit int (with INT_MIN being -INT_MAX %%- - 1). ...
Show full article (3.76Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: Ron Ford
Date: Sep 16, 2008 23:52

...F(i) = C(i) - i_max - 1 , I get all the outcomes. 2 questions here. 1) Why do I believe that b = min(max(1,ceiling(harvest*sides)),sides) is better than b = -i_max + int( harvest * i_tot ) ? 2) How did I not write out of bounds on an array with affairs being off by one ?? -- Most people are unable to write because they are unable to think, and they are unable to think...
Show full article (1.70Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: glen herrmannsfeldt
Date: Sep 16, 2008 23:36

...sides)),sides) is different that the previously suggested: > b = -i_max + int( harvest * i_tot ) ceiling(harvest*sides) mostly returns a value between... the counts in k(i_max+1) Either use floor() or int(), or subtract one. As far as the original question, ...fourth, not one eighth. If you have two (approximately) symmetric distributions uniform over, for example, the range (-1/2...
Show full article (1.50Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: Ron Ford
Date: Sep 16, 2008 22:43

... harvest, diff, t3, t4 ! seed random num generator [snip] do i...give equiprobable integers on the interval of [-i_max , i_max] ? No. It...call random_number(harvest) b = -i_max + int( harvest * i_tot ) k(b) = k...picking a random integer over a range. 1 + int ( 6 * harvest...harvest, diff, t3, t4 ! seed random num generator CALL init_random_seed ! prime...
Show full article (4.40Kb) · Show article thread
Re: random ints on symmetric interval     

Group: comp.lang.fortran · Group Profile · Search for random ints on symmetric interval in comp.lang.fortran
Author: e p chandler
Date: Sep 16, 2008 20:45

... real:: harvest, diff, t3, t4 ! seed random num generator [snip] do i = 1, ...does this prog give equiprobable integers on the interval of [-i_max , i_max] ? No. It looks like you...i=1,trials call random_number(harvest) b = -i_max + int( harvest * i_tot ) k(b) = k(b) + ... way of picking a random integer over a range. 1 + int ( 6 * harvest), for example, is the classical ...
Show full article (1.86Kb) · Show article thread
1 · 2 · next