Skip to main content
Module

x/denops_std/function/mod.ts>srand

📚 Standard module for denops.vim
Go to Latest
function srand
import { srand } from "https://deno.land/x/denops_std@v6.4.0/function/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[]>