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
Not so much a bug, as slow!
#16
Just to complement my previous answer... My suggestion for INTRND(n) was that the compiler would generate an Assembly code equivalent to this:

Code:
'Generate random number between 0 and n-1 function INTRND(n AS UINTEGER) AS UINTEGER DIM result AS UINTEGER DIM bits AS UBYTE LET bits = number of bits in value n-1 DO LET result = RND MOD (1<<(bits-1)) LOOP UNTIL (result <= n-1) RETURN result end function

The reason I suggest this behavior to be generated internally by the compiler, instead of provided as a library, is as follows: If n is a constant, then the compiler will know the number of bits and replace it directly above. Otherwise, if n is not constant, then it should generate a simple routine to find out this value.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)