# Pick single random value from WhiteNoiseProcess

I have the following:

m = 6.137*10^-13; k = 1.5*m;
stddev = Sqrt[2*k]*Sqrt[m];
whiteNoise = WhiteNoiseProcess[stddev]


How can I produce a function that gives me for each call a single random value from WhiteNoiseProcess?

I tried the following which seems to me not very clever:

getValue[time_] := Module[
{t = time},
data = RandomFunction[whiteNoise, {t, t + 1}];
data[[2, 1, 1, 1]]
];

getValue[1]

1.64153*10^-12


I need for the upper case something similar like this:

For a NormalDistribution:

I could simply write: getValue[time_] := RandomVariate[NormalDistribution[0, 1]]

This returns also a value for real numbers which does not work with my example.

getValue[0.1]

-0.545294

getValue[1]

0.327526

• You could do RandomFunction[whiteNoise, {t, t + 1}]["FirstValue"]. – J. M.'s technical difficulties Mar 28 '18 at 14:18
• @J. M. Thanks. So there is no other solution than picking the first one from 2 (or more) values? – mrz Mar 29 '18 at 8:22
• I don't really know; that's why I didn't give an answer yet. – J. M.'s technical difficulties Mar 29 '18 at 8:26

ClearAll[getV];
getV[t_Integer]:= RandomVariate[whiteNoise[t]]


With a common random seed getV produces the same output as OP's getValue:

SeedRandom[1]
res1 = getValue /@ Range[10];
SeedRandom[1]
res2 = getV /@ Range[10];
res1 == res2


True

• Thanks a lot for your solution. – mrz Apr 5 '18 at 14:39
• @Lenoil, my pleasure. Thank you for the accept. – kglr Apr 5 '18 at 14:43