forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPy.rand.cs
More file actions
83 lines (78 loc) · 2.92 KB
/
NumPy.rand.cs
File metadata and controls
83 lines (78 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Numpy;
using Numpy.Models;
using Python.Runtime;
namespace Numpy
{
public partial class NumPy
{
/// <summary>
/// Random values in a given shape.<br></br>
///
/// Create an array of the given shape and populate it with
/// random samples from a uniform distribution
/// over [0, 1).<br></br>
///
/// Notes
///
/// This is a convenience function.<br></br>
/// If you want an interface that
/// takes a shape-tuple as the first argument, refer to
/// np.random.random_sample .
/// </summary>
/// <returns>
/// Random values.
/// </returns>
public NDarray random_rand(params int[] shape)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__ = random;
var pyargs = ToTuple(shape);
var kwargs = new PyDict();
dynamic py = __self__.InvokeMethod("rand", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return a sample (or samples) from the “standard normal” distribution.<br></br>
///
/// If positive, int_like or int-convertible arguments are provided,
/// randn generates an array of shape (d0, d1, ..., dn), filled
/// with random floats sampled from a univariate “normal” (Gaussian)
/// distribution of mean 0 and variance 1 (if any of the are
/// floats, they are first converted to integers by truncation).<br></br>
/// A single
/// float randomly sampled from the distribution is returned if no
/// argument is provided.<br></br>
///
/// This is a convenience function.<br></br>
/// If you want an interface that takes a
/// tuple as the first argument, use numpy.random.standard_normal instead.<br></br>
///
/// Notes
///
/// For random samples from , use:
///
/// sigma * np.random.randn(...) + mu
/// </summary>
/// <returns>
/// A (d0, d1, ..., dn)-shaped array of floating-point samples from
/// the standard normal distribution, or a single such float if
/// no parameters were supplied.
/// </returns>
public NDarray random_randn(params int[] shape)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__ = random;
var pyargs = ToTuple(shape);
var kwargs = new PyDict();
dynamic py = __self__.InvokeMethod("randn", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
}