3D Game Builder SDK

SDK Functions

gameRandom( float mini, float maxi )

Description

Get a random number which is in between a minimum and maximum value.

Specification

float gameRandom( float mini, float maxi )

float mini

= the minimum value

float maxi

= the maximum value

return value

= a random value within this range

Notes

Use can use this function to add random elements in your game.

For example, you can add new objects to the screen in random positions.

For Example

#include "3dgamebuilder.h"

// exported game function
DLL_EXPORT int gameLoop(void)
{
	float	value;

	while(1)
	{
		// read the controller input
		gamePadRead();
					
		// get a random number
		value = gameRandom( 1.0f, 2.0f );
		sprintf( str, "Random value between 1 and 2 = %f", value );
		gameMessage( str );

		// draw a frame
		gameStartRender();
		// (nothing to draw)
		gameEndRender();
	}

	return 0;
}

See Also

(no related functions)

Go Back

SDK Functions