00001 /* 00002 * The Mana World Server 00003 * Copyright 2007 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * The Mana World is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by the Free 00009 * Software Foundation; either version 2 of the License, or any later version. 00010 * 00011 * The Mana World is distributed in the hope that it will be useful, but 00012 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00013 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00014 * more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with The Mana World; if not, write to the Free Software Foundation, Inc., 00018 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 #include "utils/tokendispenser.hpp" 00022 00023 #include <cstdlib> 00024 00025 std::string utils::getMagicToken() 00026 { 00027 std::string magic_token(MAGIC_TOKEN_LENGTH, ' '); 00028 00029 for (int i = 0; i < MAGIC_TOKEN_LENGTH; ++i) 00030 { 00031 // A random integer with uniform distribution in the interval [1, 127] 00032 magic_token[i] = 1 + std::rand() % 127; 00033 } 00034 00035 return magic_token; 00036 }