Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Out of memory when using uinteger array (*solved*)
#17
Hi.

I tried what you suggested and I came up with this:
Code:
rn=(randint()/86)+1
if rn>3 then border 4:stop:end if
print at 0,0;rn;

Two of those are for testing purposes but this code fails because it is not random enough as the sequence begins to repeat itself. But rn is an 8bit value so I should change it to uinteger and provide a different
divider unless you know of a faster way other than division?
Quote:I can add a library <rand.bas> which contains a randint() routine, for example (it's just a simple call to RAND routine).

I think that would be a very good idea 8)

EDIT:
Code:
__LABEL__DrawTriangles:
    call _randint
    ld de, 21846
    call __DIVU16
    inc hl
    ld (_rn), hl

It worked by changing the divider from 86 to 21846 using a uinteger variable.

Thanks.

By the way, the library, it would be "nice" if it would accept arguments like RND. For example, UIRND for unsigned integer RND or a ULIRND for a unsigned long integer RND.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)