aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/pluginConditionRandom.cpp
blob: 42a4e00eb2b2e987ca9a2b7653bc2c359bb6ee64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "condition.h"
#include <stdlib.h>

class ConditionRandom : public Condition
{
public:
	ConditionRandom()
	{
	}

	virtual ~ConditionRandom()
	{
	}

	virtual bool shouldExec( class Runner &, class Target & )
	{
		if( (random()/(double)RAND_MAX) >= .5 )
			return true;
		return false;
	}

	virtual Condition *clone()
	{
		return new ConditionRandom();
	}
};

#include <bu/plugger.h>
PluginInterface3( pluginConditionRandom, random, ConditionRandom, Condition,
		"Mike Buland", 0, 1 );