Hello,

this continues a thread 
https://groups.google.com/g/fricas-devel/c/zSamEbPXRwQ/m/TmHfWltgBAAJ
that I started in 2019 and is connected to this thread about random numbers.
https://groups.google.com/g/fricas-devel/c/C2YxwxnnSMs/m/DKkMJKWTBAAJ

I could now use Qian's suggestion

)lisp (setf *random-state* (make-random-state t)) 

since in my case I can simply pipe that command in with every new start 
of FriCAS (like in FRICAS_INIT).

However, since random$Integer is, in fact, just calling Lisp, it would be 
nice to
add a function

seedRandom(): Void == SEED_-RANDOM()$Lisp

to integer.spad and si.spad or simply into the category IntegerNumberSystem

with an implementation

(defun seed-random () (setf *random-state* (make-random-state t)))

in vmlisp.lisp or somewhere else.

As far as I understand the documentation of (make-random-state t), it gets 
its
randomness from/dev/urandom or time+pid if possible. Both would be good 
enough
for my case and even if it does not help on some weird systems, it should 
certainly
be a bit better than having no random source at all.

What's your opinion? 
Waldek would you include such code? If yes, where?

Ralf


On Saturday, February 23, 2019 at 4:06:51 PM UTC+1 oldk1331 wrote:

> "random" in Integer simply calls "random" in common lisp.
>
> And I looked at common lisp standard (section 12.9, CLTL2),
> the standard way to have a new seed is
>
> )lisp (setf *random-state* (make-random-state t))
>
> but the detail is implementation dependent.
>
> That makes me to think we should have a standard random
> number generator in FriCAS that is independent on underlying Lisp.
>
>
> On Sat, Feb 23, 2019 at 10:08 PM Ralf Hemmecke <[email protected]> wrote:
> >
> > Hello,
> >
> > I use random(n)$Integer in a program and use that to generate a
> > filename. Unfortunately, when I run that program in parallel, i.e., like
> > two instances of
> >
> > cat prog.input | fricas -nosman
> >
> > it produces exactly the same random integer.
> >
> > Probably understandable, however I haven't found a way to give different
> > seeds the random number generator.
> >
> > Any suggestion?
> >
> > In fact, I don't actually care about random numbers if only I get a
> > unique filename to which I can add different extensions.
> >
> > Ralf
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "FriCAS - computer algebra system" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/fricas-devel/9b2814a7-ee25-a99d-6105-c59d539b3f37%40hemmecke.org
> .
> > For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/4eefea29-eab7-4745-aaa8-4211d936192an%40googlegroups.com.

Reply via email to