Re: Random numbers according to histos and functions.

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue May 20 1997 - 14:50:00 MEST


OLSZEWSKI@vsk02.ifj.edu.pl wrote:
> 
>  Hi,
> 
>   it would be nice to have a function generating random numbers according
> to a histogram or function.
> 

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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:18 MET