Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>lab1</title>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
- <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
- <style>
- .inner{
- margin: 30px 30px;
- }
- .description{
- }
- </style>
- </head>
- <body>
- <div class = "inner">
- <div class = "description">
- <h4 align="center">The values are generated using recurrence expression Xn+1 = (Xn*a + c) mod m</h4>
- </div>
- <h5>modul m , 0 < m </h5>
- <div class="alert alert-primary" role="alert">
- 2^12-1
- </div>
- <h5>multiplier a, 0 < a < m </h5>
- <div class="alert alert-primary" role="alert">
- 4^5
- </div>
- <h5>increment c, 0 <= c < m </h5>
- <div class="alert alert-primary" role="alert">
- 2
- </div>
- <h5>start value x0, 0 <= x0 <= m </h5>
- <div class="alert alert-primary" role="alert">
- 8
- </div>
- <input id="count" type="number" value="1" min="1" max="25" step="1"/>
- <br>
- <button type="button" class="btn btn-primary btn-block btn-lg" onclick="generate()">Generate numbers</button>
- <div class="form-group shadow-textarea">
- <br>
- <!-- <label for="exampleFormControlTextarea6">Shadow and placeholder</label>-->
- <textarea class="form-control z-depth-1" id="exampleFormControlTextarea6" rows="4" placeholder="generated numbers..."></textarea>
- </div>
- </div>
- <script src="./src/bootstrap-input-spinner.js"></script>
- <script>
- $("input[type='number']").inputSpinner()
- var $changedInput = $("#count")
- var $valueOnInput = $("#count")
- var $valueOnChange = $("#count")
- $changedInput.on("input", function (event) {
- //alert("ff");
- $valueOnInput.html($changedInput.val())
- // alert("hello")
- })
- $changedInput.on("change", function (event) {
- // alert("ff");
- $valueOnChange.html($changedInput.val())
- // alert("hel")
- })
- function generate() {
- $("textarea#exampleFormControlTextarea6").val("");
- alert($valueOnChange.val());
- var m = Math.pow(2, 14) - 1
- var a = Math.pow(6, 5)
- var c = 2;
- var x0 = 8;
- var result = "";
- for (var i = 0; i < $valueOnChange.val(); i++) {
- x0 = (a * x0 + c) % m;
- result = result + " " + x0.toString();
- }
- $("textarea#exampleFormControlTextarea6").val(result);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement