Re: SDL-News: random number gen

Subject: Re: SDL-News: random number gen
From: Martin von Loewis (
Date: Wed Nov 25 1998 - 17:51:24 GMT

The originator of this message is responsible for its content.
-----From Martin von Loewis <> to sdlnews -----

> I would like to be able to generate random integers in SDL. I seem to
> remember seeing something doing this by making use of Timers and real time.

To generate an arbitrary integer, use the expression


To generate an integer from an interval, subtype integer first.
If you want to use it with timer, you probably want random durations
instead, which you can write as


If you want this to specify action in a state after an unspecified
amount of time (as in

   set (now + any(duration), T);
   nextstate waiting;
   state waiting;
   input T;

), you can also use spontaneous transitions:

   nextstate waiting;
   state waiting;
    input none;

Hope this helps,

-----End text from Martin von Loewis <> to sdlnews -----
For help, email "" with the body of your email as:
or (iff this does not answer your question) email:

This archive was generated by hypermail 2a23 : Sun Jun 16 2013 - 10:41:40 GMT