aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/pluginConditionRandom.cpp
blob: facd2014089d1621833f172cbc9f5057be1219e3 (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 );