.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

การ random number Options · View
paedotnet
Posted: Sunday, September 21, 2008 11:35:45 AM

Rank: มือเทพ
Groups: Member

Joined: 12/6/2007
Posts: 345
Location: bkk

การใช้งาน Random Number
คำสั่งที่ใช้ในการ random number จะเป็นคำสั่งที่ทำหน้าที่สุ่มตัวเลขต่างๆ โดยจะใช้งานคำสั่งนี้ได้จะต้อง
ติดตั้ง PSCX ก่อน download ได้ที่ :  http://www.codeplex.com/PowerShellCX
cmdlet:  Get-Random
คำสั่ง Get-Random นี้จะทำหน้าทีสร้าง ตัวเลขระหว่าง 0 ถึง 1
ตัวอย่าง

ถ้า พิมพ์ Get-Random  ทางโปรแกรมก็จะทำหน้าที่สุ่มตัวเลขไปเรื่อยๆซึ่งแต่ละครั้งจะมีค่าไม่เท่ากัน
แต่ถ้าต้องการสุ่มตัวเลข ระหว่างค่าที่เราต้องการก็ทำได้โดยใช้ parameter -min,-max ดังนี้
Get-Random -min 10  -max 20



[With great power comes great responsibility]
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by