🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.amiga.tech
5 messages
5 total messages Started by J I L Gold Thu, 22 Nov 1990 13:32
Lattice BLink problem
#6918
Author: J I L Gold
Date: Thu, 22 Nov 1990 13:32
11 lines
1127 bytes
In one of the modules in the game I'm writing, I'm needing to get
a random number. So, I #include <math.h> and use the function
drand48() to give a double in [0,1). In my BLink LIB section,
I've tried lcffp.lib and lcmieee.lib (or whatever they were),
and both times the linker chokes up something like _CX405 un-
defined (default _stub). So what library do I use to link 
the module properly?
-- 
#  J.Gold                            |    mapjilg@uk.ac.bath.gdr               #
#  University of Bath , UK           |    jilg@uk.ac.bath.maths                #
#  The more improbable an event is, the more likely it is to happen :-)        #
Re: Lattice BLink problem
#7005
Author: Z*A*P*H*O*D
Date: Mon, 26 Nov 1990 18:13
27 lines
1551 bytes
In article <1990Nov22.133240.12613@gdr.bath.ac.uk> mapjilg@gdr.bath.ac.uk (J I L Gold) writes:
>In one of the modules in the game I'm writing, I'm needing to get
>a random number. So, I #include <math.h> and use the function
>drand48() to give a double in [0,1). In my BLink LIB section,
>I've tried lcffp.lib and lcmieee.lib (or whatever they were),
>and both times the linker chokes up something like _CX405 un-
>defined (default _stub). So what library do I use to link 
>the module properly?

I don't realy know much about C but you could link a module with the following
assembly language program, this will return a psedo random number (it is in
fact the current raster beam Y-position...
you could use it if you are realy desperate...

start
	move.b $dff006,random
	rts

Massive eh? 



-- 
*********///  O O **A member of S.H.I.T. (Super High Intelegence Team)**///***
*       ///    u    Fight, defeat and kill organized laming.           ///   *
*  \\\ ///    ---  Zaphod of Intuition  csg019@uk.ac.cov.cck ok?  \\\ ///    *
****\\X//**********************************************************\\X//******
Re: Lattice BLink problem
#7435
Author: Jean-Michel Forgeas
Date: Wed, 12 Dec 1990 12:45
21 lines
1271 bytes
In article <1990Nov22.133240.12613@gdr.bath.ac.uk>, J I L Gold writes:

> In one of the modules in the game I'm writing, I'm needing to get
> a random number. So, I #include <math.h> and use the function
> drand48() to give a double in [0,1). [...]

Don't know if you really want a double, but if not you'll find all you
need into amiga.lib (1.2, 1.3, 2.0x):

extern ULONG RangeSeed;             /* declared in amiga.lib */
    ...
    RangeSeed = your_seed_value;
    ...
    your_random_number = RangeRand( maximum );
    ...
--
                                     \___/
Jean-Michel Forgeas                   \-/
cbmvax!cbmehq!cbmfra!swinjm!forgeas    |    The Software Winery
                                      -^-
                           And, where is the universe ?
Re: Lattice BLink problem
#7458
Author: Randell Jesup
Date: Wed, 12 Dec 1990 23:32
23 lines
1564 bytes
In article <1990Nov26.181340.17891@cck.cov.ac.uk> csg019@cck.cov.ac.uk (Z*A*P*H*O*D) writes:
>I don't realy know much about C but you could link a module with the following
>assembly language program, this will return a psedo random number (it is in
>fact the current raster beam Y-position...
>you could use it if you are realy desperate...
>
>start
>	move.b $dff006,random
>	rts

	Unfortunately, that produces an extremely poor random number.  First,
it's limited to 0-255, secondly certain values will never show up (due to 
vblank interrupts, TOF stuff, etc eating all the cpu for those lines), 
thirdly, the distribution of the numbers remaining will be uneven due to
PAL machines having more than 256 lines, and NTSC having less.

	Just Say No.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com  BIX: rjesup  
Thus spake the Master Ninjei: "If your application does not run correctly,
do not blame the operating system."  (From "The Zen of Programming")  ;-)
Re: Lattice BLink problem
#7789
Author: -~=Zaphod=~-
Date: Fri, 04 Jan 1991 12:58
35 lines
2086 bytes
In article <16490@cbmvax.commodore.com> jesup@cbmvax.commodore.com (Randell Jesup) writes:
>In article <1990Nov26.181340.17891@cck.cov.ac.uk> csg019@cck.cov.ac.uk (Z*A*P*H*O*D) writes:
>>I don't realy know much about C but you could link a module with the following
>>assembly language program, this will return a psedo random number (it is in
>>fact the current raster beam Y-position...
>>you could use it if you are realy desperate...
>>
>>start
>>	move.b $dff006,random
>>	rts
>
>	Unfortunately, that produces an extremely poor random number.  First,
>it's limited to 0-255, secondly certain values will never show up (due to 
>vblank interrupts, TOF stuff, etc eating all the cpu for those lines), 
>thirdly, the distribution of the numbers remaining will be uneven due to
>PAL machines having more than 256 lines, and NTSC having less.
>
>	Just Say No.

I know its a lame way thats why i said only use if if you were desperate :)

I  think you'll  probably have to look  it up in a maths book, there is a way
of getting a pseudo random number by using LOG's and other mathmatical stuff,
but i'm not  so hot on that side of things.....


I suppose you could mesure how long it takes AmigaDOS to  corrupt a disk, 
thats VERY random number.


-- 
*********///  O O **A member of S.H.I.T. (Super High Intelegence Team)**///***
*       ///    u    Fight, defeat and kill organized laming.           ///   *
*  \\\ ///    ---      Zaphod (TCC)  csg019@uk.ac.cov.cck ok?     \\\ ///    *
****\\X//**********************************************************\\X//******
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