Skip to content
Snippets Groups Projects
Commit 7d2482fb authored by Andrew Maclean's avatar Andrew Maclean Committed by GitHub
Browse files

Merge pull request #397 from chakravarthi589/Add_-RandomSequence

Add  random sequence

Former-commit-id: 9622cbbc
parents e7a1c559 b0cf6856
No related branches found
No related tags found
No related merge requests found
......@@ -203,6 +203,7 @@ It would be appreciated if there are any Java VTK experts who could convert any
| -------------- | ---------------------- | ------------- | ------- |
[DistanceBetweenPoints](/Java/SimpleOperations/DistanceBetweenPoints) | vtkMath | Example Program to find squared distance and the Euclidean distance between two 3D points.
[PerspectiveTransform](/Java/SimpleOperations/PerspectiveTransform) | vtkPerspectiveTransform | It is used to describe the full range of homogeneous transformations. It was designed in particular to describe a camera-view of a scene
[RandomSequence](/Java/SimpleOperations/RandomSequence) | vtkMinimalStandardRandomSequence | Park and Miller Sequence of pseudo random numbers.
## Swing Integration
......
import vtk.vtkNativeLibrary;
import vtk.vtkMinimalStandardRandomSequence;
public class RandomSequence
{
// -----------------------------------------------------------------
// Load VTK library and print which library was not properly loaded
static
{
if (!vtkNativeLibrary.LoadAllNativeLibraries())
{
for (vtkNativeLibrary lib : vtkNativeLibrary.values())
{
if (!lib.IsLoaded())
{
System.out.println(lib.GetLibraryName() + " not loaded");
}
}
}
vtkNativeLibrary.DisableOutputWindow(null);
}
// -----------------------------------------------------------------
public static void main(String s[])
{
//Create a random sequence generator.
vtkMinimalStandardRandomSequence Sequence = new vtkMinimalStandardRandomSequence();
//initialize the sequence
Sequence.SetSeed(1);
//Get 3 random numbers.
double x = Sequence.GetValue();
Sequence.Next();
double y = Sequence.GetValue();
Sequence.Next();
double z = Sequence.GetValue();
Sequence.Next();
// You can also use Sequence.GetRangeValue(-1.0, 1.0) to set a range on the random values.
System.out.println("X:"+x + "\n" + "Y:" + y + "\n" + "Z:"+ z);
}
}
### Description
vtkMinimalStandardRandomSequence object is a sequence of statistically independent pseudo random numbers uniformly distributed between 0.0 and 1.0.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment