libfoedus-core
FOEDUS Core Library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
uniform_random.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
20 namespace foedus {
21 namespace assorted {
22 
24  uint32_t* ints = reinterpret_cast<uint32_t*>(memory->get_block());
25  uint64_t count = memory->get_size() / sizeof(uint32_t);
26  for (uint64_t i = 0; i < count; ++i) {
27  ints[i] = next_uint32();
28  }
29 }
30 
31 } // namespace assorted
32 } // namespace foedus
33 
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
void * get_block() const
Returns the memory block.
uint64_t get_size() const
Returns the byte size of the memory block.
Represents one memory block aligned to actual OS/hardware pages.
void fill_memory(foedus::memory::AlignedMemory *memory)
Fill up the give memory with random data.