Created
December 15, 2012 03:56
-
-
Save usagi/4291249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/multi_array.hpp> | |
#include <algorithm> | |
#include <random> | |
#include <iostream> | |
int main(){ | |
using value_type = size_t; | |
const size_t dimension = 3; | |
using c = boost::multi_array<value_type, dimension>; | |
const size_t scaling = 2; | |
auto a = c(boost::extents[scaling][scaling][scaling]); | |
auto origin_begin = a.origin(); | |
auto origin_end = origin_begin + a.num_elements(); | |
const value_type index_initial = 0; | |
std::iota(origin_begin, origin_end, index_initial); | |
std::random_device rd; | |
std::mt19937_64 rng(rd()); | |
std::shuffle(origin_begin, origin_end, rng); | |
for(const auto& a0: a) | |
for(const auto& a1: a0) | |
for(const auto& v: a1) | |
std::cout << v << " "; | |
std::cout << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment