|
|
Up |
|
|
  |
Author: Howard JaegermeisterHoward Jaegermeister Date: Aug 7, 2008 16:08
I enjoy games of chance and using computer science to enlighten the
situation. I'm trying to simulate the roll of a single six-sided die and
don't see why I've got nothing so far:
integer, dimension(6)::A
integer:: b
real:: harvest
A = 0
call random_number(harvest)
b = floor(harvest*6)
print *, harvest, b
end program
I would expect repeat to be a real pseudorandom on the open unit interavl
and b to be the result. Got nothing. Thanks for help,
--
Howard
|
| |
|
| | 20 Comments |
|
  |
Author: mecej4mecej4 Date: Aug 7, 2008 16:33
Howard Jaegermeister wrote:
> I enjoy games of chance and using computer science to enlighten the
> situation. I'm trying to simulate the roll of a single six-sided die and
> don't see why I've got nothing so far:
>
>
>
> integer, dimension(6)::A
>
> integer:: b
>
> real:: harvest
>
> A = 0
>
> call random_number(harvest)
>
> b = floor(harvest*6)
>
> ...
|
| Show full article (0.67Kb) |
|
| | no comments |
|
  |
Author: nospamnospam Date: Aug 7, 2008 16:35
Howard Jaegermeister wrote:
> integer, dimension(6)::A
> integer:: b
> real:: harvest
> A = 0
> call random_number(harvest)
> b = floor(harvest*6)
>
> print *, harvest, b
>
> end program
>
> I would expect repeat to be a real pseudorandom on the open unit interavl
> and b to be the result. Got nothing. Thanks for help,
|
| Show full article (1.73Kb) |
| no comments |
|
  |
Author: Howard JaegermeisterHoward Jaegermeister Date: Aug 7, 2008 18:24
On Thu, 07 Aug 2008 16:35:04 -0700, Richard Maine wrote:
> Howard Jaegermeister wrote:
>
>> integer, dimension(6)::A
>> integer:: b
>> real:: harvest
>> A = 0
>> call random_number(harvest)
>> b = floor(harvest*6)
>>
>> print *, harvest...
|
| Show full article (2.13Kb) |
| no comments |
|
  |
Author: nospamnospam Date: Aug 7, 2008 22:04
Howard Jaegermeister wrote:
> I got no output, so I'll fiddle with my build environment for starters.
I can't help with that without more data. I probably has nothing at all
to do with the source code, though.
> It seems that you and mece got the same result: .983 Do I need to seed
> something so this result is pseudorandom on the open unit interval like
>
> srand(&timer);
>
> from C?
I don't speak C enough to comment about how one would do it in C.
See the RANDOM_SEED intrinsic in Fortran. Yes, seeding it with something
from the time of day is common. Unfortunately, the standard doesn't
specify whether a call to random_seed with no arguments initializes with
the same seed every time or with a different seed on each call. It
varies among processors.
|
| Show full article (1.79Kb) |
| no comments |
|
  |
Author: Ron FordRon Ford Date: Aug 7, 2008 22:18
On Thu, 7 Aug 2008 22:04:05 -0700, Richard Maine posted:
> Howard Jaegermeister wrote:
>
>> I got no output, so I'll fiddle with my build environment for starters.
>
> I can't help with that without more data. I probably has nothing...
|
| Show full article (1.94Kb) |
| no comments |
|
  |
Author: Ron FordRon Ford Date: Aug 7, 2008 22:26
On Thu, 07 Aug 2008 18:33:34 -0500, mecej4 posted:
>> and b to be the result. Got nothing. Thanks for help,
> I don't get the same nothing (G95 under Cygwin-32):
>
> $ g95 harv.f90
> $ ./a
> 0.9839003 5
>
> -- mecej4
The only results I can see are when wine and Plato III do their greek
thing.
How do I achieve this result on ubuntu? How's cygwin doing?
Cheers,
--
War will never cease until babies begin to come into the world with larger
cerebrums and smaller adrenal glands. 2
H. L. Mencken
|
| |
| no comments |
|
  |
Author: Gib BogleGib Bogle Date: Aug 7, 2008 22:39
Richard Maine wrote:
> Howard Jaegermeister wrote:
>
>> integer, dimension(6)::A
>> integer:: b
>> real:: harvest
>> A = 0
>> call random_number(harvest)
>> b = floor(harvest*6)
>>
>> print *, harvest, b
>>
>> end program
>>
>> I would expect repeat to be a real pseudorandom on the open unit interavl
>> and b to be the result. Got nothing. Thanks for help,
>
> A little more precision in the question would help. In particular, what
> do you mean by "got nothing." I can't sensibly interpret that in this
> context. The closest I can come to a literal interpretation would be ...
|
| Show full article (1.62Kb) |
| no comments |
|
  |
Author: james.annanjames.annan Date: Aug 8, 2008 00:08
On Aug 8, 2:39 pm, Gib Bogle auckland.no.spam.ac.nz> wrote:
> Richard Maine wrote:
>> Howard Jaegermeister wrote:
>
>>> integer, dimension(6)::A
>>> integer:: b
>>> real:: harvest
>>> A = 0
>>> call random_number(harvest)
>>> b = floor(harvest*6)
>
>>> print *, harvest, b
>
>>> end program
>
>>> I would expect repeat to be a real pseudorandom on the open unit interavl
>>> and b to be the result. Got nothing. Thanks for help,
>
>> A little more precision in the question would help. In particular, what
>> do you mean by "got nothing." I can't sensibly interpret that in this ...
|
| Show full article (2.08Kb) |
| no comments |
|
  |
|
|
  |
Author: Howard JaegermeisterHoward Jaegermeister Date: Aug 8, 2008 17:34
On Fri, 08 Aug 2008 00:08:48 -0700, james.annan@ gmail.com wrote:
> On Aug 8, 2:39 pm, Gib Bogle auckland.no.spam.ac.nz> wrote:
>> Richard Maine wrote:
>>> Howard Jaegermeister wrote:
>>
>>>> integer, dimension(6)::A
>>>> integer...
|
| Show full article (3.12Kb) |
| 1 Comment |
|
|
|
|