<< qr | DD: 16 bytes decimal arithmetics | ddzeros >>

DD_QD (MuPAT) >> DD_QD (MuPAT) > DD: 16 bytes decimal arithmetics > ddrand

# ddrand

(Quasi) Pseudorandom DD number generator

### Syntax

    a = ddrand(m,n)
    a = rand(DDmat)

### Parameters

m,n

  positive integers: numbers of rows and columns

DDmat

  a matrix of DD numbers

a

  matrix of size [m,n] or size(DDmat) of random DD numbers, with uniform distribution on [0,1[.

### Description

ddrand() uses the rand() generator. To set the generator, please refer to the rand() page.

### Examples

    ddrand(1,1)    // scalar
    ddrand(1,4)    // vector
    ddrand(2,3)    // matrix

    d = d2dd([1 2 3 ; 4 5 6]);  // template
    rand(d)

    --> ddrand(1,1)    // scalar
     ans  =
       3.948993250361848903819918622785E-1

    --> ddrand(1,4)    // vector
     ans  =
    [d1]
       0.706149   0.6787831   0.4132936   0.1402291

    [d2] 10^-17 *
      -4.6128991  -0.491101   0.3302046   0.9724391

    --> ddrand(2,3)    // matrix
     ans  =
    [d1]
       0.2512136   0.3921976   0.3361603
       0.3389102   0.4681552   0.5336877

    [d2] 10^-17 *
       0.5967803  -0.5662747   2.5888306
       0.4666782  -1.0359787   4.0207999

    --> d = dd([1 2 3 ; 4 5 6]);  // template
    --> rand(d)
     ans  =
    [d1]
       0.3184586   0.4254902   0.251896
       0.5761894   0.9761982   0.4391129

    [d2] 10^-17 *
      -0.0354794  -2.3726398   0.9995478
       5.2432006  -3.7086932  -0.0837781

### See Also

- rand
- qdrand — (Quasi) Pseudorandom QD number generator
- ddzeros — generates a matrix made of DD zeros
- ddones — generates a matrix made of DD ones
- ddeye — Identity matrix
- dd — builds an array of DD numbers

### Authors

Copyright (C) 2011 - Tsubasa Saito

Report an issue
<< qr | DD: 16 bytes decimal arithmetics | ddzeros >>