Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

RandomController.cpp

Go to the documentation of this file.
00001 #include "RandomController.h"
00002 #include "Random.h"
00003 
00004 RandomController::RandomController(unsigned int nInputs, unsigned int nOutputs, unsigned int randSeed):
00005    Controller(nInputs, nOutputs){
00006       Random::setSeed(randSeed);
00007       unsigned int i;
00008       for(i=0;i<nOutputs;i++)
00009          output[i]=Random::getFloat();
00010 }
00011 
00012 RandomController::~RandomController(){
00013 
00014 }
00015 
00016 void RandomController::advanceTime(){
00017    unsigned int i;
00018    for(i=0;i<nOutputs;i++){
00019       output[i]+=(Random::getFloat()-0.5f)/10.0f;
00020       if(output[i]<0.0) output[i]=0.0;
00021       if(output[i]>1.0) output[i]=1.0;
00022    }
00023 
00024 }

Thyrix homepageUsers' guide

(C) Arxia 2004-2005