Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

randreset

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Resets the random number generator seed.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = randreset;

Resets the random number seed based on the clock time.

This function returns the random number seed that was used.

out = randreset(seed);

Set the seed to a specific value

 

Example

This example shows how to fix the seed used to generate a set of random numbers. Note that if the same seed number is used for both sets the random numbers will be the same.

set1 = matrix(5);

set2 = matrix(5);

 

randreset(23);

 

for (i=1:5){

    set1(i) = rand;

}

 

randreset(23);

for (i=1:5){

    set2(i) = rand;

}

 

?set1;

?set2;

 

result: 

0.517298  

0.669097  

0.946963  

0.184988  

0.76546  

result: 

0.517298  

0.669097  

0.946963  

0.184988  

0.76546  

 

See Also

Functions, rand, randmatrix

Copyright Lumerical Inc. | Privacy | Site Map