•  Back 
  •  Special commands 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help page 
  •  Show info about hypertext 
  •  View a new file 
Topic       : TOS - The Operating System
Author      : 
Version     : tos.hyp (December 19, 2008)
Subject     : Programmieren/Atari
Nodes       : 3010
Index Size  : 93790
HCP-Version : 5
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Title
@help       : 
@options    : +g -i -s +x +zz -t4
@width      : 70
View Ref-File4.18.7  Random                                                     TOS

 Name:         »random generator« - Random number generator

 Opcode:       17

 Syntax:       int32_t Random( void );

 Description:  The XBIOS routine Random returns a 24-bit random number 
               (based on a clock in the computer).

               Note: With this function we are not dealing with a 
               hardware random number generator, but with a software 
               version, which uses the following algorithm:

               X = (X * 3.1415926...) + 1

               The return value is X shifted by 8 bits to the right, 
               i.e. using the lower three bytes of the returned 
               int32_t. Incidentally, the behaviour for the complete 
               number is pretty good, the inquiry of individual bits 
               in the sense of reduced randomness is however not 
               advisable.

 Return value: The function returns a 24-bit random number.

 Availability: All TOS versions.

 Group:        Special commands

 See Also:     Binding