LoginSignup
0
0

More than 3 years have passed since last update.

P5.js 日本語リファレンス(randomSeed)

Last updated at Posted at 2020-05-24

このページでは「P5.js 日本語リファレンス」 の randomSeed関数を説明します。

randomSeed()

説明文

random() のシード値を設定します。

random() のシード値を設定します。デフォルトでは、プログラムが実行されるたびに random() は異なる結果を生成します。実行するたびに同じ結果を生成するには seed に定数を設定します。

構文

randomSeed(seed)

パラメタ

  • seed
    Number:シード値

例1

// 実行する度に同じ動きになります。
let xoff = 0.0;

function setup() {
  createCanvas(200, 200);
  randomSeed(15);
}

function draw() {
  background(204);
  xoff = xoff + 0.01;
  let n = random(xoff) * width;
  line(n, 0, n, height);
}

実行結果

著作権

p5.js was created by Lauren McCarthy and is developed by a community of collaborators, with support from the Processing Foundation and NYU ITP. Identity and graphic design by Jerel Johnson.

ライセンス

Creative Commons(CC BY-NC-SA 4.0) に従います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0