<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>auewe</author_name>
  <author_url>https://blog.hatena.ne.jp/auewe/</author_url>
  <blog_title>余白の書きなぐり</blog_title>
  <blog_url>https://auewe.hatenablog.com/</blog_url>
  <categories>
    <anon>C</anon>
    <anon>数値計算</anon>
    <anon>OpenMPI</anon>
    <anon>並列計算</anon>
  </categories>
  <description>普通の(並列計算でない)プログラムで乱数を使用する際に、 プログラムを実行するたびに異なる系列で擬似乱数を発生させるには seed に現在時刻を使用するのが一般的だ。 要するに srand((unsigned) time(NULL)); とすればよい。詳細は以下のページにまとまっている。 srand 擬似乱数の発生系列を変更する OpenMPIで乱数を使用する際はどうすればよいか? さきほどと同じように設定すると、 myrank==0でもmyrank==1でも同じseedを使用することになる。 サンプルコード // single_seed.c #include &lt;stdio.h&gt; #inclu…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fauewe.hatenablog.com%2Fentry%2F2013%2F07%2F22%2F081506&quot; title=&quot;OpenMPIで乱数を使う - 余白の書きなぐり&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>2013-07-22 08:15:06</published>
  <title>OpenMPIで乱数を使う</title>
  <type>rich</type>
  <url>https://auewe.hatenablog.com/entry/2013/07/22/081506</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
