unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* exposing seed_random to lisp?
@ 2011-03-16 21:17 joakim
  2011-03-17  2:17 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: joakim @ 2011-03-16 21:17 UTC (permalink / raw)
  To: Emacs developers

"random" has a hardcoded facility to seed the pseudo random
generator. Would a patch to expose seed_random to lisp be okay?

-- 
Joakim Verona



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: exposing seed_random to lisp?
  2011-03-16 21:17 exposing seed_random to lisp? joakim
@ 2011-03-17  2:17 ` Stefan Monnier
  2011-03-17  2:22   ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-03-17  2:17 UTC (permalink / raw)
  To: joakim; +Cc: Emacs developers

> "random" has a hardcoded facility to seed the pseudo random
> generator. Would a patch to expose seed_random to lisp be okay?

I don't see why not.  Send your patch,


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: exposing seed_random to lisp?
  2011-03-17  2:17 ` Stefan Monnier
@ 2011-03-17  2:22   ` Paul Eggert
  2011-03-17  8:12     ` joakim
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Eggert @ 2011-03-17  2:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: joakim, Emacs developers

On 03/16/2011 07:17 PM, Stefan Monnier wrote:
> I don't see why not.

I see one gotcha: a seed that is an Emacs fixnum
typically does not contain enough entropy to cover
all the possible seeds that seed_random can accept.
One possible workaround is to have the seed be a list
of fixnums rather than just a single fixnum.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: exposing seed_random to lisp?
  2011-03-17  2:22   ` Paul Eggert
@ 2011-03-17  8:12     ` joakim
  0 siblings, 0 replies; 4+ messages in thread
From: joakim @ 2011-03-17  8:12 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Stefan Monnier, Emacs developers

Paul Eggert <eggert@cs.ucla.edu> writes:

> On 03/16/2011 07:17 PM, Stefan Monnier wrote:
>> I don't see why not.
>
> I see one gotcha: a seed that is an Emacs fixnum
> typically does not contain enough entropy to cover
> all the possible seeds that seed_random can accept.
> One possible workaround is to have the seed be a list
> of fixnums rather than just a single fixnum.

Good catch. For compatibility with future super Emacsen, the function
could accept different types:
- single fixnum with too little entropy
- list of fixnums
- future bignum

list of fixnums would be my initial attempt.

-- 
Joakim Verona



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-17  8:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-16 21:17 exposing seed_random to lisp? joakim
2011-03-17  2:17 ` Stefan Monnier
2011-03-17  2:22   ` Paul Eggert
2011-03-17  8:12     ` joakim

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).