Menu ▾ ▴

#872 Manual Section 18.1 incorrectly states rndseed is 1 on startup, but is actually process ID

v1.0 (example)
open-fixed
None
5
2 days ago
2026-10-03
No

Section 18.1 of the User's Manual (version 47, August 11th, 2026) states in Section 18.1:

"If no input is given, then ngspice sets the seed (stored in variable rndseed) to 1 upon start up."

The actual behavior seems to be that the random seed is set to the process ID.

For example, with the attached script, the result should be the same every time if the seed is the same every time. Instead we get:

for i in 1 2 3 4 5 6 7 8 9 10 ; do ngspice -b default_seed.cir| fgrep resistance ; done
@r1[resistance] = 9.825701e+02
@r1[resistance] = 8.915465e+02
@r1[resistance] = 1.182747e+03
@r1[resistance] = 9.995695e+02
@r1[resistance] = 8.620584e+02
@r1[resistance] = 9.839922e+02
@r1[resistance] = 1.007452e+03
@r1[resistance] = 9.485660e+02
@r1[resistance] = 1.039764e+03
@r1[resistance] = 8.351679e+02
1 Attachments

Discussion

  • Holger Vogt

    Holger Vogt - 2 days ago
    • status: open --> open-fixed
    • assigned_to: Holger Vogt
     
  • Holger Vogt

    Holger Vogt - 2 days ago

    Fixed by commit
    059066b53 ("Fix bug 873 main.c: initialise rndseed to 1 and and get random numbers by initw(). inp.c: extract options seed=val|random in netlist and script files. wallace.c: if initw is called a second time, re-allocate memory, not just overwrite it (memory leak!).", 2026-10-05)

     

Log in to post a comment.