[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Random number generation in LISP or using it
From: |
Thomas A. Russ |
Subject: |
Re: Random number generation in LISP or using it |
Date: |
10 Jun 2009 11:21:40 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
bolega <gnuist006@gmail.com> writes:
> The function "random" does not work in emacs.
How does it not work?
It seems to work for me.
> start line and end line of a marked region and then use that to
> disorder (or re-order) the lines according to a list of random numbers
> generated ?
You could look up shuffling algorithms.
http://en.wikipedia.org/wiki/Shuffle#Shuffling_algorithms
http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
[snip]
> In this case one needs to generate a random number that is an integer
> and lies between the lines start and end of region. It can be done by
> some modulo type operation if available in emacs lisp.
You shouldn't need to do that, since the built-in RANDOM function can do
that for you. Try ^H f random <CR>
--
Thomas A. Russ, USC/Information Sciences Institute
- Random number generation in LISP or using it, bolega, 2009/06/11
- Re: Random number generation in LISP or using it, Colin S. Miller, 2009/06/10
- Re: Random number generation in LISP or using it, TomSW, 2009/06/11
- Re: Random number generation in LISP or using it, bolega, 2009/06/11
- Re: Random number generation in LISP or using it,
Thomas A. Russ <=
- Re: Random number generation in LISP or using it, Thomas A. Russ, 2009/06/11
- Re: Random number generation in LISP or using it, Xah Lee, 2009/06/11