Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>fn.srand

Dark deno-powered completion framework for neovim/Vim
Go to Latest
function fn.srand
import { fn } from "https://deno.land/x/ddc_vim@v4.0.2/deps.ts";
const { srand } = fn;

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[]>