为了账号安全,请及时绑定邮箱和手机立即绑定

懒逼版随机数

懒逼版随机数

慕瓜8829151 2017-03-21 16:56:03
public void Stringtest2(){ List<String> string=new ArrayList<String>(); Random random=new Random(); //28      //String[]s={"q","w","e","r","t","y","u","i","o","p","[","a","s","d","f","g","h","j","k","l",";","z","x","c","v","b","n","n","m"};       String s="mnbvcxz431fghjkl&*%uytrewq";        int k; String s2=null; for(int i=0;i<10;i++){  do{ k=random.nextInt(26); s2=s.substring(k); }while (s2.length()>10);  string.add(i,s2); }   System.out.println("-------排序前-------"); for (String string2 : string) {   System.out.println(string2); } System.out.println("-------排序后-------"); Collections.sort(string); for (String string2 : string) {   System.out.println(string2); } }自己测试了,感觉还是有点规律可循,有谁能解释下吗
查看完整描述

1 回答

已采纳
?
wldraa

TA贡献33条经验 获得超17个赞

s2 = s.substring(k);

这一句每次都是截取从第 k 个字条到结尾的字符串。所以所有的s2 都是 s 的最后几位

查看完整回答
1 反对 回复 2017-03-21
?
慕瓜9220888

TA贡献868条经验 获得超0个赞

NIZOHUBSI

OQGFESYSD

BRYUVMRPT

ZPWMCFGDK

SUKJBPDHB

DICKKBLPZ

SQFXCIZVB

TUMYAAEXQ

MSEDLHHHL

LYBPKIBID

GJJKBCLSZ

NSPERWKZO

BSIVBLCEH

KQWFRLSTK

FSSSXHJGD

TRNCUBYEK

MDDLOVOZK

IAZYAIFLF

XVENPGWKE

XMIREBPMG

YAAMSSTDX

FDWFXEFPP

PHGPEFDXR

TJCXDDLYS

OEKZIJPAA

HMLONQHEE

IHGPURYPH

YWXDVWQKK

FNMQCQGXX

ZNWPERIQK

CKSETHNKB

NVWVOVMGM

VDMBARHOP

DRKJSZPGG

YMIHWOYZT

HVLDWLLCC

IZCQYPJQQ

RZYHGTARB

IWPYABFJJ

VGQKQFVQN

OPVOHNYFF

QQYJXDKRR

BYENPMDDN

WEAZIIAAL

LTCBVJPJK

FDOQVVWWQ

FDDZIBOCC

YOHKGQGRV

XMLATJABL

DLODDNAUE

MKZIREVUE

MBALDROYI

NNWWVSFCZ

RJLUTKUUV

SAZYOLAQB

IFHQMTXNO

VTCEUKLSC

CKZIGNNOS

ODVLKROEF

GLKJIZGYZ

OSBAGWTZZ

BFEDTAYCD

KITZWNNKO

OPIRKBVLF

ETZSAOLIC

CHQVELIZZ

ZXGFUVPWW

UCRLOYVCW

JQFIXXLVF

ZKUILPYZP

BJSPHQNMG

CWHVWAGZG

QNYGSQIAG

PZNPDXSMV

BHQIOAQEO

UCLKCTPFW

KJBARPCFW

PNWYYMTAU

ODFVXULII

XFOETQGDE

AYHGPZJKU

PXTDMTDXI

PNQLOFFZJ

LAUDNKQKR

BJVUZGDKL

RZYAGXXXY

HSIUTDUJJ

IKDLLROPW

NBETCLBCC

AFBQJZDTK

FXXHOSWTU

FUJCLSPZG

JYHJVMGTN

IWPYHHUBC

XVXYXLLSZ

XVOGWGDAK

SUJSHQXNH

GORGCJGXW

WRAJLDHYO

AOXNVCGTB

IQSYKRRLW

LTIRQFFGQ

BWLNDAXNN

DJDEXSNDP

TSUNOLSJP

LASLUHELL

DVHTUVPSM

OGVEDUEVV

AFNNFCZWQ

JOHXHRQKK

PPFXGNEIL

PXWFIQHYO

NFUDCPOLC

TVHQTOPGA

LNODITJGH

QKYASJJPF

ZOGMBMCTT

TSKDCJQXH

FNDSBSCCN

RFUTYPGGX

YXFYHYWDO

NPYDGDHRL

GRHGVMTJK

LUWFHYYVW

WBQMEUBFV

EVEHAQXOE

PFYRTKKYY

UCLTTTGPZ

MLAPYFMCN

QIRDGLMZJ

JIXWPPCZQ

NBQTSZWGQ

DXQZQHUHR

WOEDMSPQQ

IKCKJPNNN

BWVXQHHGA

VLUDCMGDX

CQTMERSVG

MBDWPMCJN

CARGCJQXH

VTTSUEBFF

WCLKDNNHS

EDZRVYILY

UEETIZZQA

VIDFSHIMU

KYLQAYLAB

PTCPTQSJV

EMVUNUBLF

GXIMNZYDM

JCYBQGDAH

WBADDKLCO

EFFUTQTKK

KSLUJQQLJ

KIOQJGDAA

EDFIMGTAK

PDQFOVYSJ

BJMFFXEUC

CCBBAQUUF

UCBKJQQUB

QNZYFWTTE

DIRWZPQAU

KPYXBOVVZ

WBNGFFWDU

GVUJSFSGR

IXIRGUXHS

MKDWISCDT

NFKNXYVCS

INWVKOERI

TONWEVZPM

NVETPWVFF

YDCLUBBIZ

RPEHQQHYF

WNQPRPCST

FKJITZAAB

PEXMVLWGA

QRAWCJGYI

XLBVKHYIJ

JRGPRYVZN

YMYXGDOUV

AZWFERGNE

查看完整回答
反对 回复 2021-10-19
  • 1 回答
  • 0 关注
  • 1435 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信