每次path.getrandomfilename都会生成一个唯一的文件名吗? [英] Will path.getrandomfilename generate a unique filename every time?

查看:264
本文介绍了每次path.getrandomfilename都会生成一个唯一的文件名吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Path.GetRandomFileName每次都会生成唯一的文件名吗?另外,Path.GetTempFileName怎么样-会生成唯一的名称吗?

Will Path.GetRandomFileName generate a unique filename every single time? Also, what about Path.GetTempFileName - will that generate a unique name?

推荐答案

在两种情况下,简短的答案都是肯定的.
实际上,它会生成11个随机字符,这意味着有(26 +10)^ 11个可能的名称(1.316217e + 17),因此不存在两次创建相同名称的可能性,并且出于所有实际目的.

The short answer is yes in both cases.
In reality get it will generate 11 random chars that means there are (26 +10)^11 possible names (1.316217e+17) so chances of creating the same name twice are none existand for all practical purposes.

有关更多信息,建议您阅读

For more information I suggest you read this

和相关的 MSDN 页面

这篇关于每次path.getrandomfilename都会生成一个唯一的文件名吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆