小编tla*_*oon的帖子

使用Bash生成乐透号码

我有一个简单的bash脚本生成以下内容:

These are your winning lottery numbers: 
 27  6   29  17  15  47
 19  16  33  15  20  14
 29  34  48  19  33  40
Run Code Online (Sandbox Code Playgroud)

这是它的代码:

#!/bin/bash

tickets="$1"

function get_tickets { printf "How many tickets are you going to get? "; read tickets;}

function gen_numbers { printf "\nThese are your winning lottery numbers: \n"; 

    for ((z=1 ; z<=tickets ; z++)); do
         for ((i=0; i<6; i++ )); do 
            x=`echo $[ 1 + $[ RANDOM % 49 ]]`; 
            printf "\t $x"; 
         done; …
Run Code Online (Sandbox Code Playgroud)

arrays bash uniq

2
推荐指数
1
解决办法
3552
查看次数

如何使用Google Maps setCenter/setZoom并设置边界以包含所有标记

我一直试图从其他帖子中弄清楚这一点,并且无法完全掌握它.这是我正在使用的代码:

<script type="text/javascript">
var mapOptions = {
  center: new google.maps.LatLng(29.4814305, -98.5144044),
  zoom: 10
};

var map = new google.maps.Map(document.getElementById("map-canvas"),
    mapOptions);

var markers = [];

// Add a marker to the map and push to the array.
function addMarker(location) {
  var marker = new google.maps.Marker({
    position: location,
    map: map,
    draggable: false,
    animation: google.maps.Animation.DROP
  });

  markers.push(marker);
}

// Sets the map on all markers in the array.
function setAllMap(map) {
  for (var i = 0; i < markers.length; i++) {
        markers[i].setMap(map);
  } …
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

0
推荐指数
1
解决办法
1357
查看次数

标签 统计

arrays ×1

bash ×1

google-maps ×1

google-maps-api-3 ×1

javascript ×1

uniq ×1