This already exists. Look at tutorial
http://root.cern.ch/root/html/examples/fillrandom.C.html
> Another question: how to define a variable in a function being loaded to ROOT
> under CINT, so that its value would not be lost between consecutive executions.
>
Do you mean between ROOT sessions or between 2 consecutive calls ?
Otherwise, look at :
http://root.cern.ch/root/CintInterpreter.html
> Remark/question: Double_t *y = new Double_t(100); doesn't seem to work properly
> under CINT? Storing into 4'th element of y generates segmentation violation.
>
I suppose you mean:
Double_t *y = new Double_t[100]
I know that this is a very frequent mistake when coming from Fortran.
the instruction new Double_t(100) means in C++:
Allocate a new object at address 100 !!
Rene Brun