Hi all, I finally found the location of the error, that I introduced in revision 34320.
It should be fixed in revision 35259. Pierre PS: Explanation for those interested: Indeed this is my fault, the incrementation of global variable mt_index was done after the 'if ...=MTWIST_N branch.. before my commit. The whole point of the commit was to have a very close setting of l_index and incrementation of mt_index directly after, and to only use the local variable l_index afterwards inside the function to minize adverse effects of multi-threaded code. > -----Message d'origine----- > De : fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal- > boun...@lists.freepascal.org] De la part de Tony > Envoyé : samedi 26 novembre 2016 16:26 > À : FPC-Pascal users discussions > Objet : [fpc-pascal] Repeat result in random > > Here is a short program to print 10 random numbers: > > program testrandom; > > var > i: Integer; > > begin > Randomize; > > for i := 1 to 10 do > WriteLn(Random); > end. > > > If I compile and run this program using FPC 3.0.0 on Ubuntu 16.04 > x86_64 I get the following: > > $ /usr/lib/fpc/3.0.0/ppcx64 testrandom > Free Pascal Compiler version 3.0.0+dfsg-2 [2016/01/28] for x86_64 > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Linux for x86-64 > Compiling testrandom.pp > Linking testrandom > /usr/bin/ld.bfd: warning: link.res contains output sections; did you > forget -T? 14 lines compiled, 0.1 sec > $ ./testrandom > 9.34558931970968842506E-0001 > 7.37956080120056867599E-0001 > 9.57959748106077313423E-0001 > 8.50854847114533185959E-0001 > 1.81509985821321606636E-0001 > 6.14049500785768032074E-0001 > 9.82306003570556640625E-0002 > 3.28659117221832275391E-0001 > 3.45761539181694388390E-0001 > 6.87781326007097959518E-0001 > > All well and good. However, if I compile using FPC 3.1.1 from svn I > get the following: > > $ /usr/local/lib/fpc/3.1.1/ppcx64 testrandom > Free Pascal Compiler version 3.1.1 [2016/11/26] for x86_64 > Copyright (c) 1993-2016 by Florian Klaempfl and others > Target OS: Linux for x86-64 > Compiling testrandom.pp > Linking testrandom > 14 lines compiled, 0.1 sec > $ ./testrandom > 3.31493919249624013901E-0001 > 3.31493919249624013901E-0001 > 5.16012400388717651367E-0001 > 2.02815276337787508965E-0001 > 5.62052882276475429535E-0001 > 9.15243660099804401398E-0001 > 7.51263931626453995705E-0001 > 9.20306718209758400917E-0001 > 9.01774314232170581818E-0001 > 7.98331435071304440498E-0001 > > The first two random numbers are always equal. > > Am I missing something or is this a bug in 3.1.1? > > Tony > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal