随机生成文件名的函数

函数|随机|文件名

随机生成文件名的函数...

<html>
<meta http-equiv="Refresh" content="2">
<!--
Place this code into an ASP Page and run it!
-->
<code>
Random FileName Creation

<%
Function Generator(Length)
dim i, tempS, v
dim c(39)
tempS = ""
c(1) = "a": c(2) = "b": c(3) = "c": c(4) = "d": c(5) = "e": c(6) = "f": c(7) = "g"
c(8) = "h": c(9) = "i": c(10) = "j": c(11) = "k": c(12) = "l": c(13) = "m": c(14) = "n"
c(15) = "o": c(16) = "p": c(17) = "q": c(18) = "r": c(19) = "s": c(20) = "t": c(21) = "u"
c(22) = "v": c(23) = "w": c(24) = "x": c(25) = "y": c(26) = "z": c(27) = "1": c(28) = "2"
c(29) = "3": c(30) = "4": c(31) = "5": c(32) = "6": c(33) = "7": c(34) = "8": c(35) = "9"
c(36) = "-": c(37) = "_": c(38) = "@": c(39) = "!"
If isNumeric(Length) = False Then
Response.Write "A numeric datatype was not submitted to this function."
Exit Function
End If
For i = 1 to Length
Randomize
v = Int((39 * Rnd) + 1)
tempS = tempS & c(v)
Next
Generator = tempS
End Function

For i = 1 to 20
Randomize
x = Int((20 * Rnd) + 1) + 10
Response.Write Generator(x) & "<br>" & vbnewline
Next
%>
</code>

时间: 2024-08-03 22:08:29

随机生成文件名的函数的相关文章

用ASP随机生成文件名的函数

<html> <meta http-equiv="Refresh" content="2"> <!-- Place this code into an ASP Page and run it! --> <code> Random FileName Creation <% Function Generator(Length) dim i, tempS, v dim c(39) tempS = ""

ASP实例学习:随机生成文件名的函数

<html>   <meta http-equiv="Refresh" content="2">   <!-- Place this code into an ASP Page and run it!   -->   <code>   Random FileName Creation   <% Function Generator(Length) dim i, tempS, v dim c(39) tempS =

随机生成文件名的函数_JSP编程

<html> <meta http-equiv="Refresh" content="2"> <!-- Place this code into an ASP Page and run it! --> <code> Random FileName Creation <% Function Generator(Length) dim i, tempS, v dim c(39) tempS = ""

【PHP】PHP使用PHPExcel生成Excel表格文件(附带随机生成英文名函数)

[PHP]PHP使用PHPExcel生成Excel表格文件(附带随机生成英文名函数) 前言 由于业务需要,我们需要从业务中汇总数据,并生成Excel文件. 思路是这样的 PHP要导出Excel表格文件->找一个好用的第三方库吧->在Composer的Packages里找一个吧->PHPExcel这么多收藏,就它了! PHPExcel 概述 PHPExcel is a library written in pure PHP and providing a set of classes th

随机生成文件名或文件夹

问题描述 在c#中编写随机生成文件名或文件夹代码 解决方案 解决方案二:大哥的语气,果然够屌解决方案三:1.用random产生随机数作为名字:2.用System.Guid.NewGuid()作为随机名字:3.如果生成不频繁,也用当前时间(精确到毫秒)作为随机名字:4.其他自定义命名方法.解决方案四:大哥的语气,够屌解决方案五:Guid.NewGuid().ToString() 也不要什么其它的了解决方案六:日期时间精确到毫秒不是挺好吗解决方案七:引用3楼lc_antt的回复: 大哥的语气,够屌

php之上传小案例,根据时间:月日分创建目录并随机生成文件名

<?php /* 接收文件,并分目录存储,生成随机文件名 1.根据时间戳,并按一定规则创建目录 2.获取文件名的后缀名 3.判断大小 */ //根据月日分计算并创建目录 function mk_dir(){ $dir = date('md/i', time()); if(is_dir('./' .$dir)){ return $dir; }else{ mkdir('./'.$dir,0777,true); return $dir; } } //获取文件后缀 function getExt($fi

谷歌面试题:给定能随机生成整数1到5的函数,写出能随机生成整数1到7的函数

给定能随机生成整数1到5的函数,写出能随机生成整数1到7的函数. 我的想法: 编写一个生成0和1的随机函数:  step1. 调用给定的随机函数original_rand()生成一个数  如果==3 goto step1  如果<3 return 0  如果>3 return 1  编写一个生成1到7的随机函数  调用生成0和1的随机函数3次,构成000或001或010.......  如果???不等于0返回,否则重新生成. int rand_01() { int r = original_r

javascript-js只有Math.random()随机生成,具体怎么用?这种函数会出错么

问题描述 js只有Math.random()随机生成,具体怎么用?这种函数会出错么 js只有Math.random()随机生成,具体怎么用?这种函数会出错么 js只有Math.random()随机生成,具体怎么用?这种函数会出错么 解决方案 Math.random() 方法可返回介于 0 ~ 1 之间的一个随机数,js中Math是一个对象,random是他的方法,直接调用就行. 这个函数不会出错,除非你之前的js代码编写得有问题,导致没有执行Math.random从而没有反应 var r=Mat

PHP随机生成唯一HASH值自定义函数_php技巧

网上有很多种方法获取随机唯一的HASH值,但是大同小异: 1.先获取随机的唯一字符串 2.进行MD5或者sha1算HASH值 一个项目要用到hash值,就去网上找了找,却发现PHP有一个函数能直接生成唯一字符串--uniqid(),通过使用这个函数,再加上自己生成的随机数(防止被破解),更具有唯一性且不易被猜解.主要考虑问题如下: 1.随机的效率与随机性:rand和mt_rand函数的选择,首选mt_rand,效率高,随机性好: 2.随机次数:选择5次,本来unniqid就是唯一的,加上随机的可