The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Out of memory when using uinteger array (*solved*)
#20
Darkstar Wrote:I think I get it now, the first line only gives 86 possible combinations.
That's it!

In fact, better do CAST(Ubyte, Rand()). This is the fastest way, however, many random number generators suggest to use a middle 2nd byte, so:
Code:
Function Fastcall RandByte as Ubyte asm call RAND ; 32 bit rand number in de:hl ld a, e ; take the 2nd higher byte; Ubyte functs returns result in A reg. end asm End Function
Another way is to use AND 0xFF (byte), or AND 0xFFFF (ubyte), but CAST is the best way (or just direct assignement).
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)