Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/denops_std/function/vim/mod.ts>srand

๐Ÿ“š Standard module for denops.vim
Go to Latest
function srand
import { srand } from "https://deno.land/x/denops_std@v3.9.0/function/vim/mod.ts";

Initialize seed used by |rand()|:

  • If {expr} is not given, seed values are initialized by reading from /dev/urandom, if possible, or using time(NULL) a.k.a. epoch time otherwise; this only has second accuracy.
  • If {expr} is given it must be a Number. It is used to initialize the seed values. This is useful for testing or when a predictable sequence is intended. Examples: :let seed = srand() :let seed = srand(userinput) :echo rand(seed)

Parameters

denops: Denops
optional
expr: unknown

Returns

Promise<unknown>