Logo Search packages:      
Sourcecode: libneuralnet version File versions  Download package

utils.cc

/*
** utils.cc
** Login : <kami@MeatFucker.Masaq>
** Started on  Wed Jul  2 23:01:50 2003 Guillaume Stordeur
** $Id: utils.cc,v 1.5 2003/07/29 19:38:29 speedblue Exp $
** 
** Copyright (C) 2003 Guillaume Stordeur
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
** 
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU Lesser General Public License for more details.
** 
** You should have received a copy of the GNU Lesser General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <iostream>
#include "utils.hh"


float mrand(float min, float max)
{
  float d = max - min;
  return (rand() / ((float)RAND_MAX)) * d + min;
}

float randWeight()
{
  float r = mrand(-0.3, 0.3);
  //if (r > -0.05 && r < 0.05)
  //  r = r > 0 ? 0.05 : -0.05;
  return r;
}

Generated by  Doxygen 1.6.0   Back to index