<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>toburau</author_name>
  <author_url>https://blog.hatena.ne.jp/toburau/</author_url>
  <blog_title>ゲームが作れるようになるまでがんばる日記</blog_title>
  <blog_url>https://toburau.hatenablog.jp/</blog_url>
  <categories>
    <anon>TIPS</anon>
  </categories>
  <description>2次元のマップに複数のキャラクターをランダムに配置しようと思い、xとyをランダムで求めようとしたが、これだとすでに配置した位置が出てしまうことがある。 そこで、2次元の配列を1次元の配列で表し、配列に先頭からキャラクターを詰めて代入。その配列をシャッフルし、再び2次元の配列に戻してやれば、ランダムに配置することが出来る。 実際にvectorとアルゴリズムのshuffleを利用して試してみたのが次のコード。 #include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;algorithm&gt; using namespace std; int main(void){…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Ftoburau.hatenablog.jp%2Fentry%2F20171201%2F1512153368&quot; title=&quot;マップにランダムに配置する - ゲームが作れるようになるまでがんばる日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-12-01 03:36:08</published>
  <title>マップにランダムに配置する</title>
  <type>rich</type>
  <url>https://toburau.hatenablog.jp/entry/20171201/1512153368</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
