Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate random numbers in the buffer?

Tags:

vim

vi

I want to generate 10 random numbers in the buffer.

In Emacs I would do:

<start macro>(random limit) <eval lisp><newline><end macro> to define the macro,

and 9 <execute macro> to generate it 10 times.

Is there a way I can do this in vim?

like image 721
Frison Alexander Avatar asked Dec 06 '13 17:12

Frison Alexander


People also ask

How do you generate the random number?

There are two main methods that a computer generates a random number: true random number generators (TRNGs) and pseudo-random number generators (PRNGs). The former uses some phenomenon outside the computer for its number generation, whereas the latter relies on pre-set algorithms to emulate randomness².


1 Answers

is this ok for you?

:r! echo $RANDOM

then

9@:

if you have certain programming language env available on your OS, you can eval those statement too.

like image 62
Kent Avatar answered Oct 05 '22 18:10

Kent