I know that there are various ways to get random numbers, eg, from the shell. However, I’m running vim on an android phone with very little compiled in. Also, it does not have to be rigorously random. The point is, what’s an interesting, or concise, or fast (that is, with vim native functions), or short way to get a sequence of reasonably good random numbers in Vim?
Share
Try something like
. I know no better option then using some of the time functions (there are two of them:
reltime()andlocaltime(), but the latter is updated only each second). I would prefer to either avoid random numbers or usepyeval('random.randint(1, 10)')(preceded bypython import random), because shell is slow and I don’t trust time-based solutions.Note: documentation says that format of the item returned by
reltime()depends on the system, thus I am usingreltimestr(), not doing something withreltime()[1]which looks like if it contains nanoseconds.