Re: random numbers in fortran




lane straatman wrote:

Since I want to simulate shuffling a deck of cards, I guess I'll ask
for 52 pseudorandoms at a pop, multiply by 52 and take the floor. I
believe this gives random ints between zero and fifty-one. Is a person
well advised to start his arrays at zero as with C?

On a machine that uses binary floatng-point, the result will
be between zero and 51 inclusive, assuming sensible
rounding (round toward positive infinity can produce 52).
On a machine that uses higher radix floating-point, such as
an IBM z-Series machine, the result can be in the range
[0, 52], even for sensible rounding. On such machines,
use truncating arithmetic, if possible, to avoid trouble.

Bob Corbett

.



Relevant Pages

  • {LSJ} Ashur Tablets Q
    ... third Ashur Tablets, or after the as-played window is closed, ... It would seem that the "up to" clarifier, as with all other cards, ... zero cards in your ashheap, and simply gain the 3 pool, but the ... or are you forced to choose at lesat 1 card, i.e. you cannot play ...
    (rec.games.trading-cards.jyhad)
  • Re: how to check RSLinx 500 installations?
    ... Is there an equivalent of a "Hello World" program in the PLC world? ... I notice the cards have 15LED each on the front. ... get a simple program to turn those LEDs on or off in a controlled way, ... down to zero and turn an LED on when it reaches zero. ...
    (sci.engr.control)
  • Re: Credit cards - yikes
    ... >>>ZERO credit cards ... >>There is a Guinness book world record for having the most credit card. ... >lowest credit limit would allow Cavanagh to charge a maximum of $50. ...
    (misc.consumers)
  • Re: Credit cards - yikes
    ... >>>A bit hard to imagine 19 credit cards per household. ... >>ZERO credit cards ... "I got started in the late 1960s" Cavanagh said. ...
    (misc.consumers)