🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.msdos.programmer
3 messages
3 total messages Started by Bryon S. Lape Sun, 24 Jan 1993 22:41
Random number function (NEEDED)
#7718
Author: Bryon S. Lape
Date: Sun, 24 Jan 1993 22:41
11 lines
922 bytes
	I need a random number generating function.  I cannot use rand()
and srand().  I am developing a Random class for c++.  Please e-mail me
with ansers or pointers.


Bryon Lape
-- 
------------------------------------------------------------------------------
              "If you know how much money you will make this year
                 within $5,000, you're broke!"  - Dave Sevren
------------------------------------------------------------------------------
Re: Random number function (NEEDED)
#7746
Author: Michael Spencer
Date: Mon, 25 Jan 1993 19:54
16 lines
1026 bytes
lape@cs.utk.edu (Bryon S. Lape) writes:

>	I need a random number generating function.  I cannot use rand()
>and srand().  I am developing a Random class for c++.  Please e-mail me
>with ansers or pointers.

Why can't you use rand() & srand()?  
Your answer may determine what can be done.

-- 

===========================================================================
Michael Spencer            |      2640 Borregas
spencer@cats.ucsc.edu      |      Aptos, CA   95003
===========================================================================
Re: Random number function (SUPPLIED)
#7756
Author: Bittware
Date: Tue, 26 Jan 1993 02:11
33 lines
1190 bytes
I coded this up from an article I think in EDN, by an engineer at 
Tektronix.  The code in the article was in some DSP assembler, and I
converted it to C (isn't that backwards??).  Anyway, it works.  I tested
it on a DSP32c output to a D/A and to a spectrum analyzer.

-----BEGIN RAN32.C-----

#include <math.h>

/* generate 32-bit random noise using DSP32c */

void ran32 (ioval)
unsigned long *ioval;
{

#define  C    0x234567
#define  Alo  0x007465
#define  Ahi  0x000010

  unsigned long Rlo, Rhi;
  unsigned long ar1, ar2, ar3;
  unsigned long t1, t2, t3;

  Rlo = *ioval & 0x00ffff;
  Rhi = *ioval >> 16;
  ar1 = Alo * Rlo;
  ar2 = Alo * Rhi;
  ar3 = Ahi * Rlo;
  t1 = (ar2 + ar3);
  t2 = t1 << 16;
  t3 = ar1 + t2;
  *ioval = C + t3;
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads