Non-random numbers (SIMH PDP-8)?

Johnny Billquist bqt at update.uu.se
Wed Jan 11 20:50:48 CST 2006


Eric J Korpela <korpela at ssl.berkeley.edu> wrote:

> Some BASICs used RND(0) to get the previous random number and RND(1)
> to generate a new number.  Some used the reverse...  Others used
> RND(N) to generate a number between 0 and N.
> 
> I think most DEC basics used RND(1) to generate a new number (except
> for VAX basic, which, IIRC just used a pseudovariable called RND to
> generate random numbers).

BASIC+2 (on the PDP-11):

.help/bp2 fun buil rnd
  The RND function returns a random number greater than or equal to zero
  and less than one.

  Format

      real-vbl = RND

  Example

  990    R_num = RND

.help/bp2 sta random
  The RANDOMIZE statement gives the random number function, RND, a new
  starting point.

  Format

      { RANDOMIZE }
      { RANDOM    }

  Example

  45     RANDOMIZE

---

I know of other BASICs as well who used that convention.

> Yep, just checked.  RND(1) seems more typical.  There are a few basic
> dialects listed on my Ahl's simple benchmark page...

I'd say it might be a bit hasty to say so. Many of those dialects you 
have there are really the same. Very many Micro computers used 
Microsofts BASIC. I wouldn't call that different dialects.

Anyhow, I grabbed the VAX BASIC version and compiled it on a PPD-11 with 
RSX and BASIC+2. Here is the result:

.run rand
  340  iterations.
  .588235E-01  seconds per iteration
Accuracy  .685425E-01
Random  6.23425

	Johnny

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt at update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol



More information about the cctalk mailing list