diff options
Diffstat (limited to 'externals/mysql/mysys/my_rnd.c')
| -rw-r--r-- | externals/mysql/mysys/my_rnd.c | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/externals/mysql/mysys/my_rnd.c b/externals/mysql/mysys/my_rnd.c deleted file mode 100644 index b7dca0f2afd..00000000000 --- a/externals/mysql/mysys/my_rnd.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (C) 2007 MySQL AB & Michael Widenius - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; version 2 of the License. - - 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 General Public License for more details. - - You should have received a copy of the GNU 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 "mysys_priv.h" -#include <m_string.h> - -/* - Initialize random generator - - NOTES - MySQL's password checks depends on this, so don't do any changes - that changes the random numbers that are generated! -*/ - -void my_rnd_init(struct my_rnd_struct *rand_st, ulong seed1, ulong seed2) -{ -#ifdef HAVE_purify - bzero((char*) rand_st,sizeof(*rand_st)); /* Avoid UMC varnings */ -#endif - rand_st->max_value= 0x3FFFFFFFL; - rand_st->max_value_dbl=(double) rand_st->max_value; - rand_st->seed1=seed1%rand_st->max_value ; - rand_st->seed2=seed2%rand_st->max_value; -} - - -/* - Generate random number. - - SYNOPSIS - my_rnd() - rand_st INOUT Structure used for number generation - - RETURN VALUE - generated pseudo random number -*/ - -double my_rnd(struct my_rnd_struct *rand_st) -{ - rand_st->seed1=(rand_st->seed1*3+rand_st->seed2) % rand_st->max_value; - rand_st->seed2=(rand_st->seed1+rand_st->seed2+33) % rand_st->max_value; - return (((double) rand_st->seed1)/rand_st->max_value_dbl); -} |
