TGC Codebase Backup



Random Plus or Minus One by =C=

18th Sep 2003 5:26
Summary

A very small function that will return a +1 or a -1 randomly.



Description

It will either return a 1 or a -1. as simple as that.

Example:
Say you know an object should be 5000 units from an other object, on the Z axis, but you want to add an element of randomness as to which side of the object this will be...

new_z = rndPM() * 5000



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    `This generates a random 1 or -1
function rndPM()
   li_pm = (RND(1)-0.5)*2
endFunction li_pm