Generating random string not like - example
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
Hi,
I want to generate a random one char string of which is not like a char.
select str from (select DBMS_RANDOM.STRING('U',1) str from dual) where str!='A';
some times i am getting NULL. How can i get some char all the time? i want to create a function using this logic. can some one help me to achieve this?
Thanks,
sg
One more way to do this... (Without function)
WITH t AS (SELECT 'X' charac FROM DUAL) --- 'X' is the input
SELECT COLUMN_VALUE letter
FROM ( SELECT *
FROM t a,
TABLE (sys.odcivarchar2list ('A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z')) b
WHERE COLUMN_VALUE <> a.charac
ORDER BY DBMS_RANDOM.VALUE ())
WHERE ROWNUM = 1;
Cheers,
Manik.
Similar Messages
-
How to generate random strings
Gday all,
So I have to create a simple guessing game where the user guesses a 3 letter string that is randomly generated:
"For each new game your program will generate three unique random numbers between 0 and 9
inclusive, and convert them into a String of three characters in the range A to J. This String will be an
input to a game, where the user tries to guess the correct letters in the correct order. Examples of valid
input Strings would be, �JAD�, �ABC�, �IBE� and �EFG�. Examples of some invalid input Strings could be
�abc�, �AAA�, �123�, �AdE� or �NME�."
Just wondering how to create this random string? I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding string, as the instructions say.
I know this is very basic, but any tips?I know how to generate a random 3 char number (num = (int) (Math.random() * 1000)) but I dont know how to convert this into a corresponding stringUse string concatenation (+ with one or two String operands).
int i = 42;
char ch1 = '*';
char ch2 = '!';
String str = "foo";
// the System.out.println() is not important
// in each case a string is being created and printed
System.out.println("" + i);
System.out.println("2 times i = " + (2 * i));
System.out.println(i + "*2=" + (2 * i));
System.out.println("" + ch1 + ch2); // hint, hint
System.out.println(1 + 2 + "???");
System.out.println("???" + 1 + 2); -
Does anyone have sample code to generate a random string of 12 characters?
Urgently needed.
Thanks very much for any replies.You could generate a random number between 1 and 999999999999 (see RUTRANDU program). Then you could convert each position in the number to a corresponding character. 0 = A, 1 = B, etc.
Hope it helps
Regards -
Hi My randomString() method is generating junk character, I know this is due to some character set problem .I have not handeled properly the generation of randomCharacter.Please help.
package javaProg.completeReferance;
import java.util.*;
import javaProg.completeReferance.*;
public class TestMap
public static void main(String [] args)
Map m= new HashMap();
System.out.println("The Size of the Map is "+m.size());
fillMap(m,12);
System.out.println("The Size of the Map after fillMap Method is "+m.size());
ArrayList1.space("");
Collection c = m.entrySet();
Iterator i=c.iterator();
displayMap(i);
public static void fillMap(Map map,int number)
for(int i=1;i<=number;i++)
map.put(nextString(5),((int)(Math.random()*500)));
public static void displayMap(Iterator i)
while (i.hasNext())
Map.Entry m= ((Map.Entry) i.next());
System.out.print(m.getKey()+" "+m.getValue());
System.out.println();
public static String nextString(int length)
int randomInt=0;
char randomChar=' ';
StringBuffer randomString = new StringBuffer("");
for(int i=1;i<=length;i++)
randomInt = ((int)(5+Math.random()*500));
randomChar = (char) randomInt;
randomString.append(randomChar);
return (randomString.toString()).trim();
}Hi It still shows juck character, below is the sample output.
We are using
t?O%q 298
?W?8! 424
pR*fz 12
]5dA? 310
Ek?7? 466
/@JYL 313
UNY 262
(⌂%3? 25
?z,?? 98
????q 414
V?0s? 370
?_?oo 91 -
Genarating random strings?
could someone please tell me if this code will generate a 'b' and a 'w'
if i tell it too. and how do i make it 5 characters long. And its says
this is how you call it and i dont have a clue what that means. and when
you answer this please dont use techincal terms cause im just learning
and i probaly wont have a clue what your talking about. thankyou.
<?php
// function to generate random strings
function RandomString($length=32)
$randstr='';
srand((double)microtime()*1000000);
//our array add all letters and numbers if you wish
$chars = array ( 'a','b','c','d','e','f');
for ($rand = 0; $rand <= $length; $rand++)
$random = rand(0, count($chars) -1);
$randstr .= $chars[$random];
return $randstr;
?>
and call it like this
<?php
echo RandomString(8);
?>
Example
ebbfbcbaeWell, first of all this is PHP code and not Java. And I am not sure but I don't think it's possible to call PHP functions in Java Code (the otehr way around it should be working though, at least with the Java Extension for PHP). So, if you are writing a Java programm, you will probably have to translate this code piece to Java.
Second. It will do what you want it to do - given you make a few modifications. You will have to change the line
$chars = array ( 'a','b','c','d','e','f');
to
$chars = array ( 'b','w');
as these are the characters you want. And you will have to call the function like this
echo RandomString(5);
if you want a string with five letters.
I don't know how much this will help you, since this code is PHP and written procedural and not object-orientented as you have to write Java in, and the translation to Java might not be that easy if you don't know much about Java. -
Generating random text for placeholders in Pages
In the templates that come with Pages the text placeholders are all in Latin, which I think looks quite professional. My question is: how can I generate random Latin text, like in the templates?
Thanks
Mac OS X (10.4.7)You can also use the nifty freeware MacLorem, which will generate random Latin text with various specifiable qualities (and can produce mock text for various other "languages").
-
Generating randomized shapes or edges
Hello
I'm trying to generate random billowy shapes (like cartoon clouds or bushes) by simply creating a shape and applying a some kid of brush/pattern/style/script/whatever to it and getting a look like in the below links.
The look I'm trying to achieve is visually simple, like the following:
http://www.clker.com/cliparts/L/U/m/P/b/J/cloud-md.png
http://static5.depositphotos.com/1003938/423/v/950/depositphotos_4232591-Clouds.jpg
I can easily draw those kinds of things by hand, however I want to be able to generate such shapes randomly.
Is such a thing possible? Are there existing brushes/patterns/styles/scripts that can pull this off? So far my search has come up with nothing, unless I'm searching wrong.
Generally I'm aware of what brushes and patterns can do, but as far as I can tell they always generate the same results each time you use them.
Perhaps a script can be made to do this?
Essentially a cloud could be drawn as a bunch of random circles grouped together, then all of them get merged into one shape.
I've never scripted in Illustrator before but I'm comfortable with code, however I'd like to avoid spending that time if someone has already done the same thing.
Cheers!I did find some interesting scripts on Adobe Exchange... these things I didn't see in Google results =(
http://www.adobe.com/cfusion/exchange/index.cfm?searchfield=cloud+random&search_exchange=& search_license=&search_rating=&search_pubdate=&Submit=Search&num=10&startnum=1&event=searc h&sort=0&dummy_tmpfield= -
How do I generate a random String
Hi, there is probably a very simple answer to this question, but nevertheless....
Is there a class I can use which will allow me to generate a random String of any length?
Many thanks.depending on which chars you want to use for the String, sometimes it is more handy to use a char[], something like
publc static final char[] CASE_SENSITIVE_ALPHNUM = {'a', ...., 'A',....'1',...};//for alphamumeric case sensitive chars
public static final char[] CASE_INSENSITIVE_ALPH = {"a", ....,'z'};
public String randString(int length, char[] charset) {
StringBuffer sBuf = new StringBuffer();
for (int i = 0; i < length; i++ ) {
sBuf.append(charset[(int)(Math.random() * charset.length)] )
return sBuf.toString(); -
HOW TO GENERATE RANDOM MEANINGFUL STRINGS ?
Friends,
How do I generate random meningfull strings ? I know how to generate strings randomly but I want to generate meaningfull names. The length is not important. Please help me in this matter as I have to implement this soon.
Thanks in advance
Ankit.Thanks for reply,
I want to generate any string randomly and also want to make sure that it is meaningfull name. I can use Random(0n class to generate random number then convert according to ascii table to char and concat these generated chars to have string but then it is not meaningfull string, it could be anything. I want the string to be meaningfull too.(any word or name in english language). I don't want to pick up already generated word or names from list randomly(i think this is what you are thinking) -
How do you generate random data info using json and spry?
I have a mobile applicaton that uses spry datasets that dynamically populate a jquery mobile listview by using a json file. Everything is operating as it should.
However, I would like to understand how to pull random objects from the json file to have them displayed on a different page.
My json file is standard and not complicated. It has several levels. Each is represented as below:
{ "Level1":
{"imageurl":"images/_myimage.png",
"someData":"S,A,P,R",
"levelLongDesc":"further description",
"name": "John Doe",
"page": "referencepage",
"description":"The description of the image"
{"imageurl":"images/_myimage.png",
"someData":"S,A,P,R",
"levelLongDesc":"further description",
"name": "John Doe",
"page": "referencepage",
"description":"The description of the image"
Json file Level1 has about 70 objects
What I would like to do is randomly load one of the Level1 object arrays into the page when the user selects a Level 1 radio button that is on the screen. I know how to create the page, radio buttons and basics, but just don't know how to pull in the random data.
I've found one code sample on this site that speaks to spry and xml, but I haven't been able to apply it in any way that works for me with the json file:
http://forums.adobe.com/message/662551
I've also googled. There isn't much on spry datasets with json and generating random info. There was a little bit on sorting, but that didn't help either.
Does anyone have a good example/tutorial of how to use the random function with spry/json?
TIA
-RachelI've done similar things before. A few thoughts for you:
1. I'm assuming you're doing a buffered period or frequency measurement on the incoming encoder pulses, right? First key point is that you'll have data that is spaced equally in position, but not equally in time. If you are looking for a time-based FFT such that increasing speed will shift your spectrum, you're going to need to go through an interpolation process to resample your data as though equally-spaced in in time.
2. Your 149 pulse per rev encoder may be a significant source of error unless its 149 pulses are placed with extreme accuracy. Any error in pulse placement violates your underlying assumption of data that is equally-spaced in position. It'll be very helpful to send your data through a software lowpass filter to attenuate those artifacts.
3. I am not sure what you mean by "decompose the buffered data (array) into a single datastream." You'll get an array of periods / frequencies from the call to DAQmx Read. If you want to use it in a LabVIEW waveform datatype, you'll first need to do the resampling to create equally-spaced-in-time data. The LabVIEW waveform datatype (and all the analysis functions like FFT that use it) depend on receiving data with a fixed constant time interval between samples.
-Kevin P. -
Generate random number and letter in a text field ...
Hi All,
I having a bit trouble when trying to generate random number and letter in application express in a text field. Say I have a licence form and when user wants to create a licence, it will provide a random licence number in the licence number field but it has to be unique. the number should be something like HQ2345. I was trying to set the following sql in default value for that text field but it is not working -
select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
from dual;
any suggesion !!!!
thanksPut this as default value for your text-item
DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
with type PL/SQL Expression. It have tested it and it works fine.
DickDral -
Hi All,
When we do a test-outlookconnectivity -protocol:http the result is a success but then we get the following:
ClientAccessServer ServiceEndpoint Scenario
Result Latency
(MS)
xxxxxxxxxxxx... xxxxxxxxxxxxxx Autodiscover: Web service request. Success 46.80
WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance
of an object.
Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [Test-OutlookConnectivity], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
So it looks like it's not completing successfully.
I can't find anything on this in particular, and don't really know how to go about solving it - We are fully up to date, Exchange 2010 Sp2 with Rollup 5-v2
Any help appreciated!hi,
I have the same issue also on Exchange 2010 SP2 RU5v2
I ran your command and get the below
[PS] C:\Installs\report\Activesync>Test-OutlookConnectivity -Protocol:http |FL
RunspaceId : ebd2c626-1634-40ad-a17e-c9a713d1a62b
ServiceEndpoint : autodiscover.domain.com
Id : Autodiscover
ClientAccessServer : CAS01.domain.com
Scenario : Autodiscover: Web service request.
ScenarioDescription :
PerformanceCounterName :
Result : Success
Error :
UserName : Gazpromuk.intra\extest_645e41faa55f4
StartTime : 8/21/2013 4:08:50 PM
Latency : 00:00:00.1250048
EventType : Success
LatencyInMillisecondsString : 125.00
Identity :
IsValid : True
WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance of an object.
Object reference not set to an instance of an object.
+ CategoryInfo : NotSpecified: (:) [Test-OutlookConnectivity], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Monitoring.TestOutlookConnectivityTask
Any help would be greatly appreciated, I also get random failures of OWA, EAS and web services, very frustrating
I have no errors in the app event log
thanks
Faisal Saleem Windows Systems Analyst 07595781867 -
When trying to access certain websites, http://redditenhancementsuite.com/ or http://www.channel4.com/programmes/the- ... od#3293733 for example, all I get is a random string of characters in my browser window like the following:
‹XmoÛ6þ>`ÿáª/Ý€ZÊËú²Í6Ð%ÍZ¬íŠ&A±O%щTI*®‡ýø='J¶”8^†._L‰wÇ{yîá)ÓG§¿Ÿ\üñᜟx÷vþí7ÓÂWeû+Eο•ô‚ ïë‰üÜš›YtbŽ—ÚO.ÖµŒ(O³ÈË/>aåŸ)+„uÒÏ¿˜ŒˆØˆWŸ”ó2Ï•§Wº:“ŒÐy£Œœ&a‚¥Ò×de9‹œ_—ÒRúˆ<ŽêNÈœ‹š°r1‹¬t1?Îÿ›Z$kœ7ÕÄp#¹úÜH»ž4jr¿ˆŸÅa7‡S.³ªöC/®Äo#r6›Eœ Ÿ’$3¹Œƒ¹83Uoù0~WJÇWpvšExý»É•ëÜqïŽÅ‡¹º5/Y–r"Ž(×^enìàÃÍUâ+ƒ‹ÆVwNOŠ€A8’š| aÅï€Åšhš«›v%0Ú‚"A†UµUQ•XJ—”fiâZ/#Z©Ü³èèé@$Õ²ðxx—¹YÄ‚\!qÛjmMÌØÞa<õzÂÛ#ûÇ°ÙÛçug²ìà„i"˜¶‘¶Q!B-BTÓ†‘ð‡¶˜"ìÍeµh¢hþÚTh"Ï!žC%7+]‘‡zuaYEóÓnsŸ…Ÿá~I8ë÷©@z²ºWùøêœÎðžOe›å_ !Qûds“5Ì Â+£;·N‡ïö)‹Zu*/?ŒÙ'˜¬Ôµÿ»ŸEŠ¥Ð×ÑüÞîS©i|¯GÂÓ€-ì4 …fL/iêŸ.®(óf€xÿŸ+BØÀVq8ç¬þÄÇ€gŒí°OЄÀ¿Ò©¥–9žœÒKÇüíL œ rz鳊,ךPý%ÒRR.\‘aóâçMÊ|–Jò†rå èPòèK‘£îwxg¬€…*œŽp…LÍ¥Ü%xYçÂÃé÷òFZ\9‹‡Ëd‡ÙSÕ¥ôÎÛmÀ—šóƃ®ÜZˆ¶§ŽÝ]’yÁíuOçcwÜùÏÜvþ‹£™ ×ûR"NN4¿‰Cýz&xšK¿ uŒÜãVÚm|;<ÌÛ;ošÔœ="" ò1êgôt;®]ôÍ+ÐÖ1]:0ªŒ‘ÛpJç;G †ÑÆ«…‚%€‚広ÜȲ6T rawpgYàÜñ•9J†ˆ®‘›“vŒ€Ó-_ö›”5S˜©cw\%Ê~bÞE Ñ#@8BšrÔ8DGN°fLï'¡×S誇#gCÑ1+žU0óàòŒLÀG‰Ë‡Ó5Á‚äºMËöÌ'H*ŸŽ…š®‹ZT„)¹‘ûˆ.P%£îRU*\Äp?dÚÏ^J‡ëù«Áˆ‚õ7ù0™ÝØvJ2€—倕:)*Î.œUºODÈïškÙ˜rú±§+TS#òÜè Zñ1£Ûš”ß—br|‹F·”òókºB’j‘]£\mMR¢XŠì\ãðÿožËJ42“9ÞÍùþèoCÁí¢·ÁÁcÐX·ÃóæîK¶C$ý}ï8šGr·žål0 ŽäöL…#¹]£àHàAóßHãÎÐ7Úý—Io${ÏxÇùçaÎRÒç—ñ„P–VTøZ[RºÞŽÝ'ãjµŠ|x@UÖø€5Õ݉óÜcö¡s“JÜVbNßm*70Ý~x‚3l24͇Olã{º|ƒ;•ÂûüÊ…V²ÌÅÊ™¡ônßN[)zÉwS§ÊÁÌâãÕø¹u°ŠŠÉµÈoÒ}‚¿*þò—ÔTÄ
The characters change depending on the website. I've tried disabling all extensions and plugins, reinstalling firefox and reinstalling java to no avail. The issue seems to be isolated to firefox, chrome is able to display the webpages without a problem. The problem occures following a malware in infection which would redirect goolgle searches in firefox. It was dealt with using Malwarebytes Anti-malware and by removing some entries from C:\WINDOWS\system32\drivers\etc\hosts file.Hi,
I tried everything above but to no avail. Windows firewall seemed to be allowing Firefox through without it actually being in the exception list. However, I did remove Firefox but this time removing all profile data too. Reinstalling Firefox seemed to make the websites work. However I then restored my bookmarks, and suddenly the websites stopped functioning again, displaying the random string of characters. Could this be an issue with my bookmarks? -
Generating .trn for mapping "Like"
Hi guys,
could you pleasen show me an example to generate a .trn to load mapping rules into an application in FDM? User's guide is not really useful. We need to create a file with the following features:
Rule Name/ Rule Desc/ HFM Account/Rule Definition/-/Script
Which are the ones you can find in FDM, to load the mapping scripts in FDM.
Could you please provide an example?
Thank you!
Cheers,
LuWhile I won't vouch for every version of FDM, I do know that for 9.3.1 and previous, you absolutely can perform "Like" and "Between" mappings with Ledgerlink files (TRA / TRN).
You can only specify a few options; however : Source account, destination account, and Description. To signify a sign flip, you put a - in front of the destination account. If you are doing a "Like" or "Between" type rule, the rule name is not specified in the TRA/TRN file, it is system created for you.
Example as follows :
1287-01-60-00;Patent; Patent Accumulated Amortization
2100-01-50-00;-Cash; Cash Sign Flip
2100*;Cash; Cash (Like Example)
19??;COGS; Cost of Goods Sold (Like Example)
1800>1850;Sales;Sales (Between Example) -
hi,
can anybode give an example code
how to generate a random number
something like this:
RandomData ran=RandomData.getInstance(...)
byte[] ranString=JCSystem.makeTransientByteArray(...
ran.generateData....
and by the way can someone explain which line to put in which part of the code
can I simply display this on a phone's screen with DisplayText proactive command ?
regards
Kubai'm using Gemplus GXXv3 cards.
And I'd like to display random data on the phone's screen using DISPLAY TEXT toolkit command.
I just wonder if I have to convert the generated data somehow.
Or can I just generate a byte array and display it using initDisplayText command.
Kuba
Maybe you are looking for
-
I can't connect my imac with my iphone 4 over bluetooth
It was connected until last month and now I can't. Please let me know if anyone have solution for my problem.
-
Hi All, I want to upload All Bank Details from flat file with one report for all the countries. Report-RFBVALL_0 (T code-BAUP) uploads only for one country at a time. There are more that 150 countries. Is there some standard report exist? Or some fun
-
Hi, I have and image on my content server that is being displayed by my weblogic portal portlet. Whenever I check-in a new revision of that image on the content server and I reload the portlet (ctrl+r on browser) I am getting the following error: .la
-
my camera raw plugin is not working
-
How to make address book larger and more readable?
extra large isn't big enough. is there a way to make the address book interface larger and more readable?