ugBASIC 1.18
An isomorphic BASIC language compiler for retrocomputers
Loading...
Searching...
No Matches
random.c File Reference
#include "../../ugbc.h"

Go to the source code of this file.

Functions

Variablerandom_value (Environment *_environment, VariableType _type)
 Emit ASM code for = RANDOM.

Function Documentation

◆ random_value()

Variable * random_value ( Environment * _environment,
VariableType _type )

Emit ASM code for = RANDOM.

This function outputs a code suitable for calculating a random value, the range of which depends on the type of data passed as a parameter:

  • ''VT_BYTE'' (BYTE) : 0...255
  • ''VT_COLOR'' (COLOR) : 0...15
  • ''VT_WORD'' (WORD) : 0...65.535
  • ''VT_ADDRESS'' (ADDRESS) : 0...65.535
  • ''VT_POSITION'' (POSITION) : 0...65.535
  • ''VT_DWORD'' (DWORD) : 0...4.294.967.295

The random value is passed back into a temporary variable.

Parameters
_environmentCurrent calling environment
_typeType of random number to generate
Returns
Variable* The random value calculated

Definition at line 80 of file random.c.