source: HiSusy/trunk/Pythia8/pythia8170/phpdoc/RandomNumberSeed.php @ 1

Last change on this file since 1 was 1, checked in by zerwas, 11 years ago

first import of structure, PYTHIA8 and DELPHES

File size: 2.9 KB
Line 
1<html>
2<head>
3<title>Random-Number Seed</title>
4<link rel="stylesheet" type="text/css" href="pythia.css"/>
5<link rel="shortcut icon" href="pythia32.gif"/>
6</head>
7<body>
8
9<script language=javascript type=text/javascript>
10function stopRKey(evt) {
11var evt = (evt) ? evt : ((event) ? event : null);
12var node = (evt.target) ? evt.target :((evt.srcElement) ? evt.srcElement : null);
13if ((evt.keyCode == 13) && (node.type=="text"))
14{return false;}
15}
16
17document.onkeypress = stopRKey;
18</script>
19<?php
20if($_POST['saved'] == 1) {
21if($_POST['filepath'] != "files/") {
22echo "<font color='red'>SETTINGS SAVED TO FILE</font><br/><br/>"; }
23else {
24echo "<font color='red'>NO FILE SELECTED YET.. PLEASE DO SO </font><a href='SaveSettings.php'>HERE</a><br/><br/>"; }
25}
26?>
27
28<form method='post' action='RandomNumberSeed.php'>
29
30<h2>Random-Number Seed</h2>
31
32The seed of the random number generator can be set as follows:
33
34<br/><br/><strong>Random:setSeed</strong>  <input type="radio" name="1" value="on"><strong>On</strong>
35<input type="radio" name="1" value="off" checked="checked"><strong>Off</strong>
36 &nbsp;&nbsp;(<code>default = <strong>off</strong></code>)<br/>
37Indicates whether a user-set seed should be used every time the
38<code>Pythia::init</code> routine is called. If off, the random number
39generator is initialized with its default seed at the beginning
40of the run, and never again. If on, each new <code>Pythia::init</code>
41call (should several be made in the same run) results in the random
42number being re-initialized, thereby possibly starting over with the
43same sequence, if you do not watch out.
44 
45
46<br/><br/><table><tr><td><strong>Random:seed </td><td></td><td> <input type="text" name="2" value="-1" size="20"/>  &nbsp;&nbsp;(<code>default = <strong>-1</strong></code>; <code>maximum = 900000000</code>)</td></tr></table>
47The seed to be used, if <code>setSeed</code> is on.<br/>
48A negative value gives the default seed,<br/>
49a value 0 gives a random seed based on the time, and<br/>
50a value between 1 and 900,000,000 a unique different random number
51sequence.
52 
53
54<p/>
55For more on random numbers see <?php $filepath = $_GET["filepath"];
56echo "<a href='RandomNumbers.php?filepath=".$filepath."' target='page'>";?>here</a>.
57This includes methods to save and restore the state of the generator,
58and some preprogrammed methods to generate non-uniform random numbers.
59
60<input type="hidden" name="saved" value="1"/>
61
62<?php
63echo "<input type='hidden' name='filepath' value='".$_GET["filepath"]."'/>"?>
64
65<table width="100%"><tr><td align="right"><input type="submit" value="Save Settings" /></td></tr></table>
66</form>
67
68<?php
69
70if($_POST["saved"] == 1)
71{
72$filepath = $_POST["filepath"];
73$handle = fopen($filepath, 'a');
74
75if($_POST["1"] != "off")
76{
77$data = "Random:setSeed = ".$_POST["1"]."\n";
78fwrite($handle,$data);
79}
80if($_POST["2"] != "-1")
81{
82$data = "Random:seed = ".$_POST["2"]."\n";
83fwrite($handle,$data);
84}
85fclose($handle);
86}
87
88?>
89</body>
90</html>
91
92<!-- Copyright (C) 2012 Torbjorn Sjostrand -->
Note: See TracBrowser for help on using the repository browser.