Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Chris Moody



On 08/15/2015 08:46 PM, Chris Moody wrote:



On 08/15/2015 07:40 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Sat, 15 Aug 2015, Chris Moody wrote:


Is there a better guide on how to do this than:
http://wiki.freepascal.org/fpcup#Linux_ARM_cross_compiler  ? specifically
as far as this
sentence is concerned:

   *  Linux/Unix build or install the relevant crossbinutils (Linux, unix)

With Ubuntu/Debian:
- apt-get install binutils-arm-linux-gnueabihf

**snip**

Thanks for that Charlie, I now have that installed. Do I have to do the
compile with fpc? or can I do it via Lazarus?

I'm pretty sure it's possible with Lazarus, but I can't give exact
instructions, because I rarely use Lazarus, I prefer using the compiler
itself directly from the command line.

However, this page has some pointers:
http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM#Make_your_first_arm-linux_project_in_Lazarus

Charlie
___

Looks like I need to recompile FPC (or make a special compile of it) 
to be able to compile to ARM.


That URL you gave me says how to compile it, but not sure about if I 
need to have some special cross compile code for the 
CROSSBINDIR=/home/user/lazarus/fpc/binutils/ portion of it, or do I 
just point it to where Linux installed the items installed with 
apt-get install binutils-arm-linux-gnueabihf ?


Thanks once again!

Chris


So I tried to compile a special version of FPC for arm, I installed: 
binutils-2.25


And I got as far as this:

/home/chris/Documents/fp/fpcbuild-2.6.4/binutils/bin/as  -o 
/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl/units/arm-linux/prt0.o arm/prt0.as

arm/prt0.as: Assembler messages:
arm/prt0.as:46: Error: unrecognized symbol type ""
arm/prt0.as:49: Error: expecting operand after ','; got nothing
arm/prt0.as:50: Error: no such instruction: `ldmia sp!,{a2}'
arm/prt0.as:53: Error: no such instruction: `ldr 
ip,=operatingsystem_parameter_argc'
arm/prt0.as:54: Error: no such instruction: `ldr 
a3,=operatingsystem_parameter_argv'

arm/prt0.as:55: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:58: Error: too many memory references for `add'
arm/prt0.as:59: Error: too many memory references for `add'
arm/prt0.as:60: Error: no such instruction: `ldr 
ip,=operatingsystem_parameter_envp'

arm/prt0.as:62: Error: invalid char '[' beginning operand 2 `[a3]'
arm/prt0.as:63: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:66: Error: no such instruction: `ldr ip,=__stkptr'
arm/prt0.as:67: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:69: Error: too many memory references for `sub'
arm/prt0.as:72: Error: no such instruction: `bl PASCALMAIN'
arm/prt0.as:75: Error: unrecognized symbol type ""
arm/prt0.as:78: Error: no such instruction: `swi 0x91'
arm/prt0.as:79: Error: no such instruction: `b _haltproc'
arm/prt0.as:82: Error: unrecognized symbol type ""
arm/prt0.as:84: Error: no such instruction: `ldr r0,=operatingsystem_result'
arm/prt0.as:85: Error: no such instruction: `ldrb r0,[r0]'
arm/prt0.as:86: Error: expecting operand after ','; got nothing
arm/prt0.as:87: Error: no such instruction: `swi 0x0'
arm/prt0.as:88: Error: no such instruction: `b _haltproc_eabi'
make[6]: *** [prt0.o] Error 1
make[6]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl/linux'

make[5]: *** [linux_all] Error 2
make[5]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl'

make[4]: *** [rtl] Error 2
make[4]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/compiler'

make[3]: *** [cycle] Error 2
make[3]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/compiler'

make[2]: *** [compiler_cycle] Error 2
make[2]: Leaving directory `/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc'
make[1]: *** [build-stamp.arm-linux] Error 2
make[1]: Leaving directory `/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc'
make: *** [fpcsrc/build-stamp.arm-linux] Error 2

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Persistent list to store objects

2015-08-17 Thread Luiz Americo Pereira Camara
TCollection with fpjsonrtti unit

See examples in packages/fcl-json folder

Luiz
Em 17/08/2015 14:06, "luciano de souza"  escreveu:

> Hello all,
>
> There are several classes which manages lists. TCollection,
> TObjectlist, TFPGObjectlist... Does someone know if one of then can be
> saved as a file and reloaded again to an object?
>
> Regards,
>
> --
> Luciano de Souza
> ___
> 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

Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Martin Schreiber
On Monday 17 August 2015 15:42:36 Michael Schnell wrote:
>
> Remote gdb:
>   - I had not been able to create the gdb (x85) / gdbserver(ARM) pair
> (not an fpc issue at all)
>   - I read that remote gdb does not allow for manually stopping a
> running program under debug if no breakpoint is reached (so it does not
> seem very desirable)
>
This works with MSEide.

Martin
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] shift right operation with variables

2015-08-17 Thread Marco van de Voort
In our previous episode, Peter said:
> I was going to comment that the 'bitmask example doesn't work, which it
> didn?t, but looks like its been recently fixed by adding the needed
> QWord cast on the '1's.
> 
> http://wiki.freepascal.org/Bit_manipulation
> 
> Qwords are certainly trickier to use the Dwords.

Actually dwords had the same problems before the introduction of int64.

Now Qword is the one type without a signed type larger than it.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Persistent list to store objects

2015-08-17 Thread Graeme Geldenhuys
On 2015-08-17 18:05, luciano de souza wrote:
> Does someone know if one of then can be
> saved as a file and reloaded again to an object?

Use TtiObjectList as defined in the tiOPF (Object Persistence
Framework). You can store the containing objects to CSV, TAB, multiple
RDBMS or even over a 3-tier (HTTP) link. tiOPF can obviously do much
more for you too.

  http://www.tiopf.com

Source code lives on SourceForge.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Persistent list to store objects

2015-08-17 Thread luciano de souza
Hello all,

There are several classes which manages lists. TCollection,
TObjectlist, TFPGObjectlist... Does someone know if one of then can be
saved as a file and reloaded again to an object?

Regards,

-- 
Luciano de Souza
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] shift right operation with variables

2015-08-17 Thread Peter
I was going to comment that the 'bitmask example doesn't work, which it
didn’t, but looks like its been recently fixed by adding the needed
QWord cast on the '1's.

http://wiki.freepascal.org/Bit_manipulation

Qwords are certainly trickier to use the Dwords.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Chris Moody



On 08/17/2015 05:15 AM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Mon, 17 Aug 2015, Michael Schnell wrote:


Cross compiling with fpc is not for that faint of heard. (Been there some
years ago)

Well, I do it 8 hours a day for a living, actually... :) I think it's
really easy these days, if you know some basics about the build system
(most of which is available from the Wiki), and how the some of the
dependencies work (binutils, mainly). Basically you can have a working
crosscompiler setup with a *single* make command in about two minutes, to
almost any system which you have binutils installed for. I wouldn't call
that hard.

And it's especially super-easy these days, when you can test most of your
cross-setup outputs on a Linux/x86 box, thanks to the user-space emulation
of a good binfmts/QEMU setup (again, available out-of-box with some
packages on Ubuntu/Debian). You don't even have to copy over to an ARM
(etc.) box...

Of course, wiring it into an IDE is a different question, that I don't
know (and don't use)...

Charlie
___


Hi again Charlie,

Do you use the MSEide software to do the cross compiling? or do you just 
call fpc with the right parameters?


Mind sharing your setup?

Thanks,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreeBSD and fpc messages.

2015-08-17 Thread Graeme Geldenhuys
On 2015-08-17 15:41, Fred van Stappen wrote:
> ...changing the background image of desktop, the battery of the
> netbook, my haircut, finally it works ...


LOL - I've had many such days, so know exactly how you feel.


Regards,
  - Graeme -

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreeBSD and fpc messages.

2015-08-17 Thread Fred van Stappen
> Well done! I'm glad you finally got it sorted out.
> 
> Regards,
>   - Graeme -

Thanks Graeme.

After trying many fpc releases, install all FreeBSD distros that exist, 
re-compiling fpc, changing the background image of desktop, the battery of the 
netbook, my haircut, finally it works ...

Happy because the next try will be to throw the computer against the wall...

Thanks.

Fre;D
  ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FreeBSD and fpc messages.

2015-08-17 Thread Graeme Geldenhuys
On 2015-08-17 14:53, fredvs wrote:
> I am very happy to have find the solution.

Well done! I'm glad you finally got it sorted out.

Regards,
  - Graeme -

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] shift right operation with variables

2015-08-17 Thread Marco van de Voort
In our previous episode, Xiangrong Fang said:
> var
>   res: Integer;
>   mask1, mask2: QWord;
> begin
>   mask1 := $ shr 24;
>   WriteLn(IntToHex(mask1, 16));
>   res := 24;
>   mask2 := $ shr res;
>   WriteLn(IntToHex(mask2, 16));
> end.
> 
> Why they are different? How can I ensure the result is like SHR with
> constant.

The first are two literals and is calculated at compiletime using the rules
for literals.

In the second is calculated at runtime one is typed an integer, probably the
large constant is downcast to integer.

To avoid that cast it to qword()

   mask2 := qword($) shr res;

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FreeBSD and fpc messages.

2015-08-17 Thread fredvs
Hello everybody.

Many, many thank to help.

I have find the guilty. ;-)

This code, in fpc.cfg was the cause of the strange characters: =>

# path to the messagefile, not necessary anymore but can be used to override
# the default language
-Fr/usr/local/lib/fpc/$fpcversion/msg/errore.msg
-Fr/usr/local/lib/fpc/$fpcversion/msg/errorn.msg
-Fr/usr/local/lib/fpc/$fpcversion/msg/errores.msg
-Fr/usr/local/lib/fpc/$fpcversion/msg/errord.msg
-Fr/usr/local/lib/fpc/$fpcversion/msg/errorr.msg

After deleting this lines, messages are ok.

And about the mystery why it was working from link in /usr/local/bin ...

There was a fpc.cfg hidden inside /usr/local/lib/fpc/2,6,4,/

Iin this fpc.cfg, there was the guilty lines (see above).

And in /etc/fpc.cfg there was not those guilty lines.

So if using complete path to compiler, compiler use fpc.cfg that is in the
directory of ppcx64.
If using /usr/local/bin/ppcx64 => this one uses /etc/fpc.cfg (who does not
have the guilty lines) !.
And that explain why, in that case, the messages are ok.

I am very happy to have find the solution.

Thanks to everybody for helping.

Fred:



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/FreeBSD-and-fpc-messages-tp5722248p5722297.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] shift right operation with variables

2015-08-17 Thread waldo kitty

On 08/16/2015 09:38 PM, Xiangrong Fang wrote:

The output is:

00FF
00FF

Why they are different? How can I ensure the result is like SHR with constant.


being curious, i tried your program with the same results... then i changed the 
var name from "res" to "foo" with the same results... i thought maybe there was 
some type conversion going on so i changed "foo" from "integer" to "QWord" and 
still got the same results... there appears to be a problem at play...


Free Pascal Compiler version 3.1.1 [2015/06/13] for x86_64

--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list* unless
   private contact is specifically requested and granted.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Michael Schnell

On 08/17/2015 02:15 PM, Karoly Balogh (Charlie/SGR) wrote:
 Of course, wiring it into an IDE is a different question, that I 
don't know (and don't use)...

That is what I was trying to do.

In fact Lazarus provides settings for OS and Arch to be used. But I did 
not get this to work at that time.


Configuring a remote debugger for Lazarus is even harder.

There are two possible ways to do that: "remote gdb" and using the 
normal gdb on the target and connecting via SSH.


Remote gdb:
 - I had not been able to create the gdb (x85) / gdbserver(ARM) pair 
(not an fpc issue at all)
 - I read that remote gdb does not allow for manually stopping a 
running program under debug if no breakpoint is reached (so it does not 
seem very desirable)


SSH:
There is code for this in Lazarus, but it is commented out. I did not 
have enough spare time to take a deeper look at that.


So we (me and a nice guy from Vienna who already started to write a 
documentation on Lazarus cross compiling and remote debugging, which I 
promised to translate into English) gave up.


-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Mon, 17 Aug 2015, Michael Schnell wrote:

> Cross compiling with fpc is not for that faint of heard. (Been there some
> years ago)

Well, I do it 8 hours a day for a living, actually... :) I think it's
really easy these days, if you know some basics about the build system
(most of which is available from the Wiki), and how the some of the
dependencies work (binutils, mainly). Basically you can have a working
crosscompiler setup with a *single* make command in about two minutes, to
almost any system which you have binutils installed for. I wouldn't call
that hard.

And it's especially super-easy these days, when you can test most of your
cross-setup outputs on a Linux/x86 box, thanks to the user-space emulation
of a good binfmts/QEMU setup (again, available out-of-box with some
packages on Ubuntu/Debian). You don't even have to copy over to an ARM
(etc.) box...

Of course, wiring it into an IDE is a different question, that I don't
know (and don't use)...

Charlie
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Jonas Maebe


Adriaan van Os wrote on Mon, 17 Aug 2015:

So, why not provide an FPC CryptoRandom function, calling into  
/dev/urandom on UNIX and CryptGenRandom  
 on  
Windows ?


Proper cryptography requires much more than just unpredictable random  
numbers. This is something that belongs in a specialised library, or  
in a set of specialised units written by experts. It has no place in a  
generic RTL unit.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Adriaan van Os

Michael Van Canneyt wrote:
In short: People interested in crypto grade randomness should use 
specialized routines, not the built-ins provided by FPC.


So, why not provide an FPC CryptoRandom function, calling into /dev/urandom on UNIX and 
CryptGenRandom  on Windows ?


Regards,

Adriaan van Os
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Michael Schnell

On 08/17/2015 11:15 AM, Michael Van Canneyt wrote:


In short: People interested in crypto grade randomness should use 
specialized routines, not the built-ins provided by FPC.

+1

As said: random numbers are a matter if taste (or of the application)

e.g. :

I once did a project where we such a wide range of integer random 
numbers that doing them as int64 was not enough


With "Monecarlo" method to estimate  statistical profitability you 
usually need random numbers as real-values to enter them in a simulated 
process. here predictability is not a great issue.


Cryptography is a completely different issue. here a decent device uses 
hardware to create the random seed.



-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Michael Van Canneyt



On Mon, 17 Aug 2015, Peter wrote:


On 17/08/15 09:05, Michael Schnell wrote:

Unfortunately "Randomize" (in Linux in "System") just does
randseed:=longint(Fptime(nil));

if it would use /dev/urandom,




Perhaps that is worthy of a bug report?


Don't bother. It's just a default. 
You can enter whatever you want in randseed if so desired.


And as Jonas pointed out, you should not use FPC's Builtin random to begin with 
if you want really random numbers, because it is perfectly predictable.


In short: 
People interested in crypto grade randomness should use specialized routines, 
not the built-ins provided by FPC.


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Peter
On 17/08/15 09:05, Michael Schnell wrote:
> Unfortunately "Randomize" (in Linux in "System") just does
> randseed:=longint(Fptime(nil));
>
> if it would use /dev/urandom, 
> 


Perhaps that is worthy of a bug report?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Mark Morgan Lloyd

Michael Schnell wrote:

On 08/14/2015 04:38 PM, Mark Morgan Lloyd wrote:


It seeds itself with "entropy" from the intervals between LAN packets, 
intervals between typed characters and so on.



Unfortunately "Randomize" (in Linux in "System") just does

randseed:=longint(Fptime(nil));

if it would use /dev/urandom, the rand() would be as unpredictable as 
/dev/urandom unless you fetch more more than some 2 Gig numbers


But I suppose you can set randseed in user code, as well, if you want to.


I agree, with the caveat that if you read /dev/urandom you can't be sure 
that there's enough accumulated entropy to give you a good seed, while 
if you read /dev/random it will block for an indeterminate time- neither 
of which are desirable behaviours in startup code. A compromise is for a 
program to wait until it knows it's generated enough entropy (LAN 
accesses or whatever), and at that point to reseed its random number 
generator, and that obviously suggests leaving the existing code unchanged.


In the past, I've seen people who should have known better caught by 
Turbo Pascal's inadequate random number generator, and there's still 
people trying to undo some of the damage caused by RANDU. These days, 
there's very little excuse for anybody "skilled in the art" to not 
understand that the random number facility in most languages' default 
libraries is not crypto grade, and that it is barely adequate for 
academic-grade simulations.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Michael Schnell

On 08/17/2015 10:14 AM, Michael Schnell wrote:


I would set randseed via randseed

Grrr. I would set randseed via /dev/urandom

-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Michael Schnell

On 08/16/2015 08:37 AM, Martin Schreiber wrote:

MSEide has a project template for cross-Pi development,


Great, Martin ! (As always :-) )

I once unsuccessfully tried to do cross compiling and remote debugging 
for my ARM based (GUI-less) QNAP NAS. I finally  compiled the project 
locally which was no real problem, as I could test the complete software 
on a PC before moving it to the NAS.


-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Michael Schnell
Cross compiling with fpc is not for that faint of heard. (Been there 
some years ago)


Please let us know where you get.


-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Michael Schnell

On 08/14/2015 04:27 PM, Xiangrong Fang wrote:



Well, practically, how can I get totally unpredictable numbers?


Nothing is totally unpredictable :-)

I would set randseed via randseed and after this you can just use rand() 
for at least 2 gig numbers without any perceptible predictability.


On stackoverflow, someone suggested using hash value of data as IV, 
but that's still flawed somehow.


There are lots of "scientific" articles on creating random numbers (I 
read some during my work at the university). Most of them are just 
nonsense.


The common request is "unpredictable" and "equal distribution".

But a "real" random generator *can (and according to Murphy will 
sometimes during Eternity) *happily create an uninterrupted series of a 
million of Zeros. To human perception this is neither unpredictable nor 
equal distribution. In fact random numbers are just a matter of taste.


-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] quality of FPC random

2015-08-17 Thread Michael Schnell

On 08/14/2015 04:38 PM, Mark Morgan Lloyd wrote:


It seeds itself with "entropy" from the intervals between LAN packets, 
intervals between typed characters and so on.



Unfortunately "Randomize" (in Linux in "System") just does

randseed:=longint(Fptime(nil));

if it would use /dev/urandom, the rand() would be as unpredictable as 
/dev/urandom unless you fetch more more than some 2 Gig numbers


But I suppose you can set randseed in user code, as well, if you want to.

-Michael
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal