download

Sign in or create your account | Project List | Help

download Git Source Tree

Root/rand.vim

1scriptencoding utf-8 " {{{ {{{
2if &cp || exists("g:loaded_rand")
3    finish
4endif
5let g:loaded_rand = 1
6
7let s:save_cpo = &cpo
8set cpo&vim " }}}
9
10function! Rand(max) " {{{
11    perl << EOF
12        my $max = VIM::Eval('a:max');
13        my $value = int(rand($max)), '\n';
14        VIM::DoCommand("let l:r = $value")
15EOF
16    return l:r
17endfunction " }}}
18
19let &cpo = s:save_cpo " {{{
20finish " }}} }}}
21==============================================================================
22rand.vim : 乱数生成ファンクション
23==============================================================================
24$VIMRUNTIMEPATH/plugin/rand.vim
25==============================================================================
26author : 小見 拓
27url : http://nanasi.jp/
28email : mail@nanasi.jp
29version : 2009/12/19 16:00:00
30==============================================================================
31乱数を生成するRand()ファンクションを定義。
32expressionレジスタを利用して、
33
34    Control-r = Rand(100)
35
36というように使う。
37現バージョンはPerlインターフェイスを使用。
38
39
40------------------------------------------------------------------------------
41Rand({max})
42    {max}以下の乱数を生成して返します。
43
44
45==============================================================================
46" vim: set ts=4 sts=4 sw=4 et nowrap foldmethod=marker :
47

Archive Download this file

Branches:
master