[Python-checkins] CVS: python/dist/src/Doc/lib librandom.tex,1.23,1.24
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 01 Feb 2001 18:42:33 -0800
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv25490/lib
Modified Files:
librandom.tex
Log Message:
Minor markup adjustments.
Index: librandom.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** librandom.tex 2001/02/01 15:53:24 1.23
--- librandom.tex 2001/02/02 02:42:31 1.24
***************
*** 35,47 ****
The functions supplied by this module are actually bound methods of a
! hidden instance of the \var{random.Random} class. You can instantiate your
! own instances of \var{Random} to get generators that don't share state.
! This is especially useful for multi-threaded programs, creating a different
! instance of \var{Random} for each thread, and using the \method{jumpahead()}
! method to ensure that the generated sequences seen by each thread don't
! overlap (see example below).
! Class \var{Random} can also be subclassed if you want to use a different
! basic generator of your own devising: in that case, override the
! \method{random()}, \method{seed()}, \method{getstate()},
\method{setstate()} and \method{jumpahead()} methods.
--- 35,49 ----
The functions supplied by this module are actually bound methods of a
! hidden instance of the \class{random.Random} class. You can
! instantiate your own instances of \class{Random} to get generators
! that don't share state. This is especially useful for multi-threaded
! programs, creating a different instance of \class{Random} for each
! thread, and using the \method{jumpahead()} method to ensure that the
! generated sequences seen by each thread don't overlap (see example
! below).
!
! Class \class{Random} can also be subclassed if you want to use a
! different basic generator of your own devising: in that case, override
! the \method{random()}, \method{seed()}, \method{getstate()},
\method{setstate()} and \method{jumpahead()} methods.
***************
*** 118,123 ****
\begin{funcdesc}{getstate}{}
! Return an object capturing the current internal state of the generator.
! This object can be passed to \code{setstate()} to restore the state.
\versionadded{2.1}
\end{funcdesc}
--- 120,126 ----
\begin{funcdesc}{getstate}{}
! Return an object capturing the current internal state of the
! generator. This object can be passed to \function{setstate()} to
! restore the state.
\versionadded{2.1}
\end{funcdesc}
***************
*** 125,142 ****
\begin{funcdesc}{setstate}{state}
\var{state} should have been obtained from a previous call to
! \code{getstate()}, and \code{setstate()} restores the internal state
! of the generator to what it was at the time \code{setstate()} was called.
\versionadded{2.1}
! \end{funcdesc}
\begin{funcdesc}{jumpahead}{n}
! Change the internal state to what it would be if \code{random()} were
! called n times, but do so quickly. \var{n} is a non-negative integer.
! This is most useful in multi-threaded programs, in conjuction with
! multiple instances of the \var{Random} class: \method{setstate()} or
! \method{seed()} can be used to force all instances into the same
! internal state, and then \method{jumpahead()} can be used to force the
! instances' states as far apart as you like (up to the period of the
! generator).
\versionadded{2.1}
\end{funcdesc}
--- 128,146 ----
\begin{funcdesc}{setstate}{state}
\var{state} should have been obtained from a previous call to
! \function{getstate()}, and \function{setstate()} restores the
! internal state of the generator to what it was at the time
! \function{setstate()} was called.
\versionadded{2.1}
! \end{funcdesc}
\begin{funcdesc}{jumpahead}{n}
! Change the internal state to what it would be if \function{random()}
! were called \var{n} times, but do so quickly. \var{n} is a
! non-negative integer. This is most useful in multi-threaded
! programs, in conjuction with multiple instances of the \var{Random}
! class: \method{setstate()} or \method{seed()} can be used to force
! all instances into the same internal state, and then
! \method{jumpahead()} can be used to force the instances' states as
! far apart as you like (up to the period of the generator).
\versionadded{2.1}
\end{funcdesc}