AminetAminet
Search:
84494 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/asm/Random250Lib.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:R250 Random number library V1.0 & source
Author:agmsmith at bix.com
Uploader:agmsmith achilles net
Type:dev/asm
Version:1.0
Requires:AmigaDOS 2.00 (V36) or later.
Architecture:m68k-amigaos
Date:1996-07-01
Download:http://aminet.net/dev/asm/Random250Lib.lha - View contents
Readme:http://aminet.net/dev/asm/Random250Lib.readme
Downloads:894

This is an implementation of the R250 pseudo-random number generator as
an Amiga library file, random250.library.  The generator is known for
it's good repetition length (10E75 numbers before it repeats) and fast
number generation speed (4 instructions for each number including the
loop overhead).  This version can return either one 32 bit number or
fill an array with any number of 32 bit random numbers.

The assembler source code is included.  Examples of using it in GNU C
and M2Sprint Modula-2 are also included.  You can easily add it to other
languages just like you add other Amiga libraries.  The two functions it
exports are:

unsigned long GenerateRandomNumber (void)
     D0
/* Returns a random number in register D0.  Follows the usual rules of
   registers a0,a1,d0,d1 being changed while the rest are preserved,
   assumes a6 points to the library base you got from calling
   OpenLibrary ("random250.library", 0).  The library offset for this
   function is -30 (decimal). */


void GenerateRandomArray (unsigned long N, unsigned long *Array)
                                 D0                A0
/* Fills the given array with N random numbers, each taking 4 bytes,
   so it fills 4*N bytes.  N in D0, array start address in A0.
   Library offset -36. */

Because it is in a library, it handles initialisation automatically
(using the current date and time, state of the Exec variables and some
other stuff to seed the generator) when opened.  It has semaphores
guarding its global seed variable so that multiple programs can use it
simultaneously.  Unfortunately, this means that there is a lot of
overhead for getting just one random number.  Instead of calling it for
each number, you should use the function that fills an array with random
numbers.

Random250.library is released to the public domain.  That means you can
hack it up.  Or just strip out the code and include it in your own
program directly for extra speed.  That also means I'm not responsible
for it running amuck.  But if you do find bugs, please let me know
because I'm using it for certain other things (like skip lists).

- Alex


Contents of dev/asm/Random250Lib.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO     CRC       STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  288     820  35.1% -lh5- 1ff1 Jun 30  1996 Random250.info
[generic]                  195     440  44.3% -lh5- ea2c Jun 30  1996 Random250/GNU C.info
[generic]                 5977   11480  52.1% -lh5- 55dd Jun 30  1996 Random250/GNU C/Test
[generic]                 1263    3338  37.8% -lh5- 7cae Jun 30  1996 Random250/GNU C/Test.c
[generic]                  288     573  50.3% -lh5- 2fb0 Jun 30  1996 Random250/GNU C/Test.c.info
[generic]                  238     411  57.9% -lh5- b136 Jun 30  1996 Random250/GNU C/Test.info
[generic]                  195     440  44.3% -lh5- ea2c Jun 30  1996 Random250/M2Sprint.info
[generic]                  375     697  53.8% -lh5- 638f Jun 30  1996 Random250/M2Sprint/Random250.def
[generic]                  284     552  51.4% -lh5- ebed Jun 30  1996 Random250/M2Sprint/Random250.def.info
[generic]                  121     144  84.0% -lh5- 476a Jun 30  1996 Random250/M2Sprint/Random250.mod
[generic]                  264     533  49.5% -lh5- 3d40 Jun 30  1996 Random250/M2Sprint/Random250.mod.info
[generic]                 5775   12276  47.0% -lh5- 2f67 Jun 30  1996 Random250/M2Sprint/Test
[generic]                  240     411  58.4% -lh5- 9967 Jun 30  1996 Random250/M2Sprint/Test.info
[generic]                 1127    3577  31.5% -lh5- a607 Jun 30  1996 Random250/M2Sprint/Test.mod
[generic]                  302     594  50.8% -lh5- 489a Jun 30  1996 Random250/M2Sprint/Test.mod.info
[generic]                  458    1280  35.8% -lh5- ab42 Jun 30  1996 Random250/R250LVOs.i
[generic]                  277     553  50.1% -lh5- 09f9 Jun 30  1996 Random250/R250LVOs.i.info
[generic]                 7688   26281  29.3% -lh5- f30e Jun 30  1996 Random250/Random250.asm
[generic]                  280     556  50.4% -lh5- efdb Jun 30  1996 Random250/Random250.asm.info
[generic]                  893    1272  70.2% -lh5- 062f Jun 30  1996 Random250/random250.library
[generic]                 1174    2295  51.2% -lh5- f54f Jun 30  1996 Random250/Random250Lib.readme
[generic]                  169     291  58.1% -lh5- 5489 Jun 30  1996 Random250/Random250Lib.readme.info
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        22 files   27871   68814  40.5%            Jul  1  1996

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>